Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -29,15 +29,19 @@ with open("example.txt") as f:
|
|
29 |
|
30 |
with gr.Blocks() as app:
|
31 |
def chat(text):
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
|
|
|
|
|
|
|
|
41 |
with gr.Column():
|
42 |
text = gr.Textbox(lines=4, label="Text", max_lines=4, placeholder="Write something awesome. It will be corrected automatically.")
|
43 |
|
|
|
29 |
|
30 |
with gr.Blocks() as app:
|
31 |
def chat(text):
|
32 |
+
try:
|
33 |
+
response = palm.generate_text(
|
34 |
+
**defaults,
|
35 |
+
prompt = f"""Rewrite the following sentence to fix the grammar issues and correct the sentence.
|
36 |
+
{example}
|
37 |
+
input: {text}
|
38 |
+
fixed"""
|
39 |
+
)
|
40 |
+
return response.result
|
41 |
+
|
42 |
+
except:
|
43 |
+
return "I am not able to correct the sentence given. Please try again."
|
44 |
+
|
45 |
with gr.Column():
|
46 |
text = gr.Textbox(lines=4, label="Text", max_lines=4, placeholder="Write something awesome. It will be corrected automatically.")
|
47 |
|