reab5555 commited on
Commit
5d94328
·
verified ·
1 Parent(s): 7edb9af

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -15
app.py CHANGED
@@ -56,7 +56,7 @@ class LazyPipeline:
56
  model=model,
57
  tokenizer=tokenizer,
58
  max_new_tokens=2048,
59
- temperature=0.5,
60
  )
61
  return self.pipeline
62
 
@@ -258,7 +258,7 @@ def update_visibility_and_charts(status, exec_time, lang, info, attachments, big
258
  gr.update(value=exec_time, visible=True),
259
  gr.update(value=lang, visible=True),
260
  gr.update(value=info, visible=True),
261
- ] + [gr.update(visible=False) for _ in range(12)]
262
 
263
  for analysis_text in [attachments, bigfive, personalities]:
264
  speakers_data = extract_speaker_data(analysis_text)
@@ -282,19 +282,9 @@ def update_visibility_and_charts(status, exec_time, lang, info, attachments, big
282
  charts.append(create_bar_chart(self_others_data, "Self-Others and Anxiety-Avoidance", speaker))
283
 
284
  print("Number of charts created:", len(charts))
285
- for i, chart in enumerate(charts):
286
- print(f"Chart {i+1} data:", chart.data)
287
-
288
- if not charts:
289
- return [
290
- gr.update(value="No charts could be created from the analysis. The output may not be in the expected format.", visible=True),
291
- gr.update(value=exec_time, visible=True),
292
- gr.update(value=lang, visible=True),
293
- gr.update(value=info, visible=True),
294
- ] + [gr.update(visible=False) for _ in range(12)]
295
 
296
  # Ensure we always return the same number of outputs
297
- chart_outputs = [chart if i < len(charts) else gr.update(visible=False) for i in range(12)]
298
 
299
  return [
300
  gr.update(value=status, visible=True),
@@ -323,7 +313,7 @@ def create_interface():
323
  bigfive_output = gr.Textbox(visible=False)
324
  personalities_output = gr.Textbox(visible=False)
325
 
326
- charts = [gr.Plot(visible=False) for _ in range(12)] # Assuming maximum 12 charts
327
 
328
  input_file.upload(
329
  fn=process_input,
@@ -338,7 +328,7 @@ def create_interface():
338
  )
339
 
340
  return iface
341
-
342
  iface = create_interface()
343
 
344
  # Launch the app
 
56
  model=model,
57
  tokenizer=tokenizer,
58
  max_new_tokens=2048,
59
+ temperature=0.6,
60
  )
61
  return self.pipeline
62
 
 
258
  gr.update(value=exec_time, visible=True),
259
  gr.update(value=lang, visible=True),
260
  gr.update(value=info, visible=True),
261
+ ] + [None for _ in range(12)]
262
 
263
  for analysis_text in [attachments, bigfive, personalities]:
264
  speakers_data = extract_speaker_data(analysis_text)
 
282
  charts.append(create_bar_chart(self_others_data, "Self-Others and Anxiety-Avoidance", speaker))
283
 
284
  print("Number of charts created:", len(charts))
 
 
 
 
 
 
 
 
 
 
285
 
286
  # Ensure we always return the same number of outputs
287
+ chart_outputs = charts + [None] * (12 - len(charts))
288
 
289
  return [
290
  gr.update(value=status, visible=True),
 
313
  bigfive_output = gr.Textbox(visible=False)
314
  personalities_output = gr.Textbox(visible=False)
315
 
316
+ charts = [gr.Plot(visible=True) for _ in range(12)] # Assuming maximum 12 charts
317
 
318
  input_file.upload(
319
  fn=process_input,
 
328
  )
329
 
330
  return iface
331
+
332
  iface = create_interface()
333
 
334
  # Launch the app