Spaces:
Runtime error
Runtime error
fix: prompt is random now
Browse files
app.py
CHANGED
@@ -4,6 +4,7 @@ import shutil
|
|
4 |
import requests
|
5 |
import threading
|
6 |
import time
|
|
|
7 |
|
8 |
import gradio as gr
|
9 |
from huggingface_hub import Repository, InferenceClient
|
@@ -118,6 +119,12 @@ def generate(
|
|
118 |
HISTORY = history
|
119 |
global PROMPT
|
120 |
PROMPT = prompt
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
|
122 |
temperature = float(temperature)
|
123 |
if temperature < 1e-2:
|
@@ -163,7 +170,7 @@ def generate(
|
|
163 |
return output
|
164 |
|
165 |
additional_inputs=[
|
166 |
-
gr.Textbox("
|
167 |
gr.Slider(
|
168 |
label="Temperature",
|
169 |
value=0.99,
|
|
|
4 |
import requests
|
5 |
import threading
|
6 |
import time
|
7 |
+
import random
|
8 |
|
9 |
import gradio as gr
|
10 |
from huggingface_hub import Repository, InferenceClient
|
|
|
119 |
HISTORY = history
|
120 |
global PROMPT
|
121 |
PROMPT = prompt
|
122 |
+
|
123 |
+
if len(PROMPT)==0:
|
124 |
+
PROMPT = random.choice(["ا","ب","پ","ت","ث","ج","چ","ح","خ","ل","م","ن","و",
|
125 |
+
"د","ذ","ر","ز","ژ","س","ش","ص","ض","ط","ظ","ع","غ",
|
126 |
+
"ف","ق","ه","ی",
|
127 |
+
])
|
128 |
|
129 |
temperature = float(temperature)
|
130 |
if temperature < 1e-2:
|
|
|
170 |
return output
|
171 |
|
172 |
additional_inputs=[
|
173 |
+
gr.Textbox("", label="Optional system prompt"), #<|endoftext|>
|
174 |
gr.Slider(
|
175 |
label="Temperature",
|
176 |
value=0.99,
|