Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -34,7 +34,24 @@ def chat(x):
|
|
| 34 |
|
| 35 |
print("\n___________________\n" + f"{x}")
|
| 36 |
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
return output
|
| 39 |
|
| 40 |
with gr.Blocks() as demo:
|
|
|
|
| 34 |
|
| 35 |
print("\n___________________\n" + f"{x}")
|
| 36 |
|
| 37 |
+
result = gradio_client.predict(
|
| 38 |
+
x,
|
| 39 |
+
# str representing input in 'User input' Textbox component
|
| 40 |
+
0.91, # float, representing input in 'Top-p (nucleus sampling)' Slider component
|
| 41 |
+
10, # int, representing input in 'Top-k (nucleus sampling)' Slider component
|
| 42 |
+
0.65, # float, representing input in 'Temperature' Slider component
|
| 43 |
+
20, # int, representing input in 'Max New Tokens' Slider component
|
| 44 |
+
1.2, # float, representing input in 'repetition_penalty' Slider component
|
| 45 |
+
fn_index=0
|
| 46 |
+
)
|
| 47 |
+
result = str(result)
|
| 48 |
+
output = result[len(x.rsplit(':', 1)[0])+2:]
|
| 49 |
+
output = re.sub('νν','γ
γ
', output)
|
| 50 |
+
output = output.split('λ')[0]
|
| 51 |
+
output = output.split('endoftext')[0]
|
| 52 |
+
output = re.sub('[=+#/\:@*\"β»γγβ|\\\<\>\(\)\[\]`\'β¦γ\β\β\βΒ·]', '', output)
|
| 53 |
+
#output = re.sub('[a-zA-Z]',' ',output)
|
| 54 |
+
|
| 55 |
return output
|
| 56 |
|
| 57 |
with gr.Blocks() as demo:
|