Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -29,18 +29,27 @@ with open("example.txt") as f:
|
|
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 |
-
{
|
37 |
input: {text}
|
38 |
fixed"""
|
39 |
)
|
|
|
|
|
|
|
40 |
return response.result
|
41 |
|
42 |
except:
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
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.")
|
|
|
29 |
|
30 |
with gr.Blocks() as app:
|
31 |
def chat(text):
|
32 |
+
f = open('/content/dump.txt', 'a')
|
33 |
try:
|
34 |
response = palm.generate_text(
|
35 |
**defaults,
|
36 |
prompt = f"""Rewrite the following sentence to fix the grammar issues and correct the sentence.
|
37 |
+
{examples}
|
38 |
input: {text}
|
39 |
fixed"""
|
40 |
)
|
41 |
+
f.write(f"""input: {text}\nfixed {response.result}\n""")
|
42 |
+
f.close()
|
43 |
+
|
44 |
return response.result
|
45 |
|
46 |
except:
|
47 |
+
result = "I am not able to correct the sentence given. Please try again."
|
48 |
+
f.write(f"""input: {text}
|
49 |
+
fixed {result}\n""")
|
50 |
+
f.close()
|
51 |
+
|
52 |
+
return result
|
53 |
|
54 |
with gr.Column():
|
55 |
text = gr.Textbox(lines=4, label="Text", max_lines=4, placeholder="Write something awesome. It will be corrected automatically.")
|