Update app.py
Browse files
app.py
CHANGED
|
@@ -4,13 +4,13 @@ from huggingface_hub import InferenceClient
|
|
| 4 |
client = InferenceClient(model="https://zgg3nzdpswxy4a-80.proxy.runpod.net")
|
| 5 |
|
| 6 |
def inference(message, history):
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
|
| 15 |
gr.ChatInterface(
|
| 16 |
inference,
|
|
|
|
| 4 |
client = InferenceClient(model="https://zgg3nzdpswxy4a-80.proxy.runpod.net")
|
| 5 |
|
| 6 |
def inference(message, history):
|
| 7 |
+
partial_message = ""
|
| 8 |
+
for token in client.text_generation(prompt=message, max_new_tokens=512, stream=True, best_of=1, temperature=0.1, watermark=True,
|
| 9 |
+
top_p=0.95, do_sample=True, repetition_penalty=1.03):
|
| 10 |
+
if token.startswith("<s>"):
|
| 11 |
+
return partial_message
|
| 12 |
+
partial_message += token
|
| 13 |
+
yield partial_message
|
| 14 |
|
| 15 |
gr.ChatInterface(
|
| 16 |
inference,
|