Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
@@ -34,7 +34,6 @@ model = AutoModelForSeq2SeqLM.from_pretrained(model_path)
|
|
34 |
|
35 |
def respond(
|
36 |
message: str,
|
37 |
-
history: list[tuple[str, str]],
|
38 |
system_message: str,
|
39 |
max_tokens: int = 128,
|
40 |
temperature: float = 1.0,
|
@@ -87,27 +86,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")
|
@@ -149,7 +127,6 @@ with gr.Blocks() as demo:
|
|
149 |
respond,
|
150 |
inputs=[
|
151 |
source_textbox,
|
152 |
-
None,
|
153 |
system_message_input,
|
154 |
max_tokens_slider,
|
155 |
temperature_slider,
|
|
|
34 |
|
35 |
def respond(
|
36 |
message: str,
|
|
|
37 |
system_message: str,
|
38 |
max_tokens: int = 128,
|
39 |
temperature: float = 1.0,
|
|
|
86 |
# ],
|
87 |
# )
|
88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
# Define the interface
|
90 |
with gr.Blocks() as demo:
|
91 |
gr.Markdown("# Google Translate-like Interface")
|
|
|
127 |
respond,
|
128 |
inputs=[
|
129 |
source_textbox,
|
|
|
130 |
system_message_input,
|
131 |
max_tokens_slider,
|
132 |
temperature_slider,
|