ouhenio commited on
Commit
65d4c90
verified
1 Parent(s): 93c46ef

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -4
app.py CHANGED
@@ -129,7 +129,14 @@ def upload_conversation(conversation_data, session_id, user_fingerprint):
129
  except:
130
  pass
131
 
132
- filename = generate_conversation_filename(session_id, user_fingerprint, datetime.now())
 
 
 
 
 
 
 
133
 
134
  with tempfile.NamedTemporaryFile(mode='w', suffix='.jsonl', delete=False) as f:
135
  json.dump(conversation_data, f)
@@ -258,13 +265,35 @@ Assistant: <utterance>
258
  In this app, you can explore the outputs of GPT-4.1 mini while contributing to LatamGPT research.
259
  """
260
 
261
- with gr.Blocks(css="""#col_container { margin-left: auto; margin-right: auto;}
262
- #chatbot {height: 520px; overflow: auto;}""") as demo:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
263
  gr.HTML(title)
264
 
265
  with gr.Column(elem_id="col_container", visible=False) as main_block:
266
  chatbot = gr.Chatbot(elem_id='chatbot')
267
- inputs = gr.Textbox(placeholder="", label="Escribe tu mensaje y presiona Enter")
 
 
 
 
 
 
268
  state = gr.State([])
269
 
270
  with gr.Row():
 
129
  except:
130
  pass
131
 
132
+ conversation_hash = generate_conversation_hash(session_id, user_fingerprint)
133
+ conversation_files = get_conversation_files()
134
+ matching_files = [f for f in conversation_files if f.endswith(f"_{conversation_hash}.jsonl")]
135
+
136
+ if matching_files:
137
+ filename = matching_files[-1]
138
+ else:
139
+ filename = generate_conversation_filename(session_id, user_fingerprint, datetime.now())
140
 
141
  with tempfile.NamedTemporaryFile(mode='w', suffix='.jsonl', delete=False) as f:
142
  json.dump(conversation_data, f)
 
265
  In this app, you can explore the outputs of GPT-4.1 mini while contributing to LatamGPT research.
266
  """
267
 
268
+ with gr.Blocks(css="""
269
+ #col_container {
270
+ margin-left: auto;
271
+ margin-right: auto;
272
+ max-width: 1200px;
273
+ width: 95%;
274
+ }
275
+ #chatbot {
276
+ height: 700px;
277
+ overflow: auto;
278
+ }
279
+ .gradio-container {
280
+ max-width: unset !important;
281
+ }
282
+ #component-0 {
283
+ max-width: unset;
284
+ }
285
+ """) as demo:
286
  gr.HTML(title)
287
 
288
  with gr.Column(elem_id="col_container", visible=False) as main_block:
289
  chatbot = gr.Chatbot(elem_id='chatbot')
290
+ inputs = gr.Textbox(
291
+ placeholder="",
292
+ label="Escribe tu mensaje y presiona Enter",
293
+ lines=3,
294
+ max_lines=8,
295
+ scale=1
296
+ )
297
  state = gr.State([])
298
 
299
  with gr.Row():