Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -41,8 +41,9 @@ def compress_history(history,temperature=temperature,top_p=top_p,repetition_pena
|
|
41 |
return output
|
42 |
|
43 |
MAX_HISTORY=100
|
44 |
-
|
45 |
def generate(prompt, history,max_new_tokens,health,temperature=temperature,top_p=top_p,repetition_penalty=repetition_penalty):
|
|
|
46 |
client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
|
47 |
|
48 |
temperature = float(temperature)
|
@@ -113,7 +114,7 @@ def generate(prompt, history,max_new_tokens,health,temperature=temperature,top_p
|
|
113 |
try:
|
114 |
if f'{z}' in lines[i+z]:
|
115 |
print(lines[i+z].split(" ",1)[1])
|
116 |
-
|
117 |
except Exception:
|
118 |
pass
|
119 |
if ": " in line:
|
@@ -138,9 +139,9 @@ def generate(prompt, history,max_new_tokens,health,temperature=temperature,top_p
|
|
138 |
|
139 |
if history:
|
140 |
history.append((prompt,output))
|
141 |
-
yield "",history,stats,skills,
|
142 |
else:
|
143 |
-
yield "",[(prompt,output)],stats,skills,
|
144 |
|
145 |
def clear_fn():
|
146 |
return None,None
|
@@ -177,9 +178,11 @@ with gr.Blocks() as app:
|
|
177 |
json_out=gr.JSON(value=base_stats)
|
178 |
char_stats=gr.Textbox(value=text_stats)
|
179 |
textboxes = []
|
180 |
-
|
181 |
-
|
182 |
-
|
|
|
|
|
183 |
#text=gr.JSON()
|
184 |
#inp_query.change(search_models,inp_query,models_dd)
|
185 |
#test_b=test_btn.click(itt,url,e_box)
|
|
|
41 |
return output
|
42 |
|
43 |
MAX_HISTORY=100
|
44 |
+
opts=[]
|
45 |
def generate(prompt, history,max_new_tokens,health,temperature=temperature,top_p=top_p,repetition_penalty=repetition_penalty):
|
46 |
+
opts.clear()
|
47 |
client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
|
48 |
|
49 |
temperature = float(temperature)
|
|
|
114 |
try:
|
115 |
if f'{z}' in lines[i+z]:
|
116 |
print(lines[i+z].split(" ",1)[1])
|
117 |
+
opts.append(lines[i+z].split(" ",1)[1])
|
118 |
except Exception:
|
119 |
pass
|
120 |
if ": " in line:
|
|
|
139 |
|
140 |
if history:
|
141 |
history.append((prompt,output))
|
142 |
+
yield "",history,stats,skills,opts
|
143 |
else:
|
144 |
+
yield "",[(prompt,output)],stats,skills,opts
|
145 |
|
146 |
def clear_fn():
|
147 |
return None,None
|
|
|
178 |
json_out=gr.JSON(value=base_stats)
|
179 |
char_stats=gr.Textbox(value=text_stats)
|
180 |
textboxes = []
|
181 |
+
if opts:
|
182 |
+
textboxes.clear()
|
183 |
+
for i in range(len(opts)-1):
|
184 |
+
t = gr.Button(f"{opts[i]}")
|
185 |
+
textboxes.append(t)
|
186 |
#text=gr.JSON()
|
187 |
#inp_query.change(search_models,inp_query,models_dd)
|
188 |
#test_b=test_btn.click(itt,url,e_box)
|