Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -152,8 +152,11 @@ def compress_data(c, instruct, history):
|
|
| 152 |
|
| 153 |
def summarize(inp,history,data=None,file=None):
|
| 154 |
#file = None
|
| 155 |
-
|
|
|
|
|
|
|
| 156 |
|
|
|
|
| 157 |
yield "",history
|
| 158 |
if file !=None:
|
| 159 |
try:
|
|
@@ -161,9 +164,10 @@ def summarize(inp,history,data=None,file=None):
|
|
| 161 |
zz=f.readlines()
|
| 162 |
f.close
|
| 163 |
print (zz)
|
|
|
|
| 164 |
except Exception as e:
|
| 165 |
print (e)
|
| 166 |
-
|
| 167 |
print(inp)
|
| 168 |
out = str(data)
|
| 169 |
rl = len(out)
|
|
@@ -210,7 +214,7 @@ with gr.Blocks() as app:
|
|
| 210 |
chatbot = gr.Chatbot()
|
| 211 |
with gr.Row():
|
| 212 |
with gr.Column(scale=3):
|
| 213 |
-
prompt=gr.Textbox("Instructions")
|
| 214 |
with gr.Column(scale=1):
|
| 215 |
button=gr.Button()
|
| 216 |
|
|
@@ -220,6 +224,7 @@ with gr.Blocks() as app:
|
|
| 220 |
clear_btn = gr.Button("Clear")
|
| 221 |
with gr.Row():
|
| 222 |
data=gr.Textbox(label="Input Data", lines=6)
|
|
|
|
| 223 |
#text=gr.JSON()
|
| 224 |
#inp_query.change(search_models,inp_query,models_dd)
|
| 225 |
go=button.click(summarize,[prompt,chatbot,data],[prompt,chatbot])
|
|
|
|
| 152 |
|
| 153 |
def summarize(inp,history,data=None,file=None):
|
| 154 |
#file = None
|
| 155 |
+
if inp == "":
|
| 156 |
+
inp = "Process this data"
|
| 157 |
+
|
| 158 |
|
| 159 |
+
history = [(inp,"Working on it...")] if not history else history
|
| 160 |
yield "",history
|
| 161 |
if file !=None:
|
| 162 |
try:
|
|
|
|
| 164 |
zz=f.readlines()
|
| 165 |
f.close
|
| 166 |
print (zz)
|
| 167 |
+
data=f'{data}\nFile:\n{zz}'
|
| 168 |
except Exception as e:
|
| 169 |
print (e)
|
| 170 |
+
|
| 171 |
print(inp)
|
| 172 |
out = str(data)
|
| 173 |
rl = len(out)
|
|
|
|
| 214 |
chatbot = gr.Chatbot()
|
| 215 |
with gr.Row():
|
| 216 |
with gr.Column(scale=3):
|
| 217 |
+
prompt=gr.Textbox(label = "Instructions")
|
| 218 |
with gr.Column(scale=1):
|
| 219 |
button=gr.Button()
|
| 220 |
|
|
|
|
| 224 |
clear_btn = gr.Button("Clear")
|
| 225 |
with gr.Row():
|
| 226 |
data=gr.Textbox(label="Input Data", lines=6)
|
| 227 |
+
file=gr.File(label="Input File")
|
| 228 |
#text=gr.JSON()
|
| 229 |
#inp_query.change(search_models,inp_query,models_dd)
|
| 230 |
go=button.click(summarize,[prompt,chatbot,data],[prompt,chatbot])
|