Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -87,27 +87,6 @@ For information on how to customize the ChatInterface, peruse the gradio docs: h
|
|
| 87 |
# ],
|
| 88 |
# )
|
| 89 |
|
| 90 |
-
# Function to process translation
|
| 91 |
-
def respond_google_translate(
|
| 92 |
-
source_text,
|
| 93 |
-
system_message,
|
| 94 |
-
max_tokens,
|
| 95 |
-
temperature,
|
| 96 |
-
top_p
|
| 97 |
-
):
|
| 98 |
-
# Call the respond function and collect the final response
|
| 99 |
-
result = ""
|
| 100 |
-
for token in respond(
|
| 101 |
-
message=source_text,
|
| 102 |
-
history=[],
|
| 103 |
-
system_message=system_message,
|
| 104 |
-
max_tokens=max_tokens,
|
| 105 |
-
temperature=temperature,
|
| 106 |
-
top_p=top_p,
|
| 107 |
-
):
|
| 108 |
-
result += token # Accumulate the tokens
|
| 109 |
-
return result
|
| 110 |
-
|
| 111 |
# Define the interface
|
| 112 |
with gr.Blocks() as demo:
|
| 113 |
gr.Markdown("# Google Translate-like Interface")
|
|
@@ -146,7 +125,7 @@ with gr.Blocks() as demo:
|
|
| 146 |
|
| 147 |
# Define functionality
|
| 148 |
translate_button.click(
|
| 149 |
-
|
| 150 |
inputs=[
|
| 151 |
source_textbox,
|
| 152 |
system_message_input,
|
|
|
|
| 87 |
# ],
|
| 88 |
# )
|
| 89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
# Define the interface
|
| 91 |
with gr.Blocks() as demo:
|
| 92 |
gr.Markdown("# Google Translate-like Interface")
|
|
|
|
| 125 |
|
| 126 |
# Define functionality
|
| 127 |
translate_button.click(
|
| 128 |
+
respond,
|
| 129 |
inputs=[
|
| 130 |
source_textbox,
|
| 131 |
system_message_input,
|