Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,15 +1,11 @@
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import InferenceClient
|
3 |
-
from googletrans import Translator
|
4 |
|
5 |
client = InferenceClient(model="https://pl0u0mrj2ag4o0-80.proxy.runpod.net")
|
6 |
-
translator = Translator()
|
7 |
|
8 |
def inference(message, history):
|
9 |
-
# Translate to English
|
10 |
-
message = translator.translate(message, dest="en").text
|
11 |
partial_message = ""
|
12 |
-
for token in client.text_generation(
|
13 |
partial_message += token
|
14 |
yield partial_message
|
15 |
|
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import InferenceClient
|
|
|
3 |
|
4 |
client = InferenceClient(model="https://pl0u0mrj2ag4o0-80.proxy.runpod.net")
|
|
|
5 |
|
6 |
def inference(message, history):
|
|
|
|
|
7 |
partial_message = ""
|
8 |
+
for token in client.text_generation(message, max_new_tokens=1024, stream=True):
|
9 |
partial_message += token
|
10 |
yield partial_message
|
11 |
|