oberbics commited on
Commit
6b0fde6
·
verified ·
1 Parent(s): 60c69c7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -19
app.py CHANGED
@@ -207,7 +207,7 @@ def process_excel(file, places_column):
207
  else:
208
  df = pd.read_excel(file)
209
 
210
- print(f"Columns in Excel file: {list(df.columns)}")
211
 
212
  if places_column not in df.columns:
213
  return None, f"Column '{places_column}' not found in the Excel file. Available columns: {', '.join(df.columns)}", None
@@ -297,11 +297,11 @@ h2 {
297
  </style>
298
  """
299
 
300
- with gr.Blocks(css=custom_css, title="Historical Data Analysis") as demo:
301
  gr.HTML("""
302
  <div style="text-align: center; margin-bottom: 1rem">
303
  <h1>Historical Data Analysis Tools</h1>
304
- <p style="font-size: 1.1rem; margin-top: -10px;">Extract, visualize, and analyze historical data with ease</p>
305
  </div>
306
  """)
307
 
@@ -309,8 +309,8 @@ with gr.Blocks(css=custom_css, title="Historical Data Analysis") as demo:
309
  with gr.TabItem("🔍 Text Extraction"):
310
  gr.HTML("""
311
  <div class="info-box">
312
- <h3 style="margin-top: 0;">Extract Structured Data from Text</h3>
313
- <p>Use NuExtract-1.5 to automatically extract structured information from historical texts.</p>
314
  </div>
315
  """)
316
 
@@ -322,11 +322,11 @@ with gr.Blocks(css=custom_css, title="Historical Data Analysis") as demo:
322
  lines=5
323
  )
324
  text = gr.Textbox(
325
- label="Text to Extract From",
326
- value="Neues Erdbeben in Japan. Aus Tokio wird berichtet...",
327
  lines=8
328
  )
329
- extract_btn = gr.Button("Extract Information", variant="primary")
330
 
331
  with gr.Column():
332
  status = gr.Textbox(label="Status")
@@ -338,11 +338,11 @@ with gr.Blocks(css=custom_css, title="Historical Data Analysis") as demo:
338
  outputs=[status, output]
339
  )
340
 
341
- with gr.TabItem("📍 Location Mapping"):
342
  gr.HTML("""
343
  <div class="info-box">
344
- <h3 style="margin-top: 0;">Map Your Historical Locations</h3>
345
- <p>Upload an Excel file containing location data to create an interactive map visualization.</p>
346
  </div>
347
  """)
348
 
@@ -354,15 +354,15 @@ with gr.Blocks(css=custom_css, title="Historical Data Analysis") as demo:
354
  elem_classes="file-upload-box"
355
  )
356
  places_column = gr.Textbox(
357
- label="Location Column Name",
358
- value="dateline_locations",
359
- placeholder="Enter the column containing locations"
360
  )
361
- process_btn = gr.Button("Generate Map", variant="primary")
362
 
363
  with gr.Column():
364
  map_output = gr.HTML(
365
- label="Interactive Map",
366
  value="""
367
  <div style="text-align:center; height:35vh; width:100%; display:flex; align-items:center; justify-content:center;
368
  background-color:#f5f5f5; border:1px solid #e0e0e0; border-radius:8px;">
@@ -375,19 +375,19 @@ with gr.Blocks(css=custom_css, title="Historical Data Analysis") as demo:
375
  elem_id="map-container"
376
  )
377
  stats_output = gr.Textbox(
378
- label="Location Statistics",
379
  lines=2,
380
  elem_classes="stats-box"
381
  )
382
  processed_file = gr.File(
383
- label="Download Processed Data",
384
  visible=True,
385
  interactive=False
386
  )
387
 
388
  def process_and_map(file, column):
389
  if file is None:
390
- return None, "Please upload an Excel file", None
391
 
392
  try:
393
  map_html, stats, processed_path = process_excel(file, column)
 
207
  else:
208
  df = pd.read_excel(file)
209
 
210
+ print(f"Spalten in der Excel-Tabelle: {list(df.columns)}")
211
 
212
  if places_column not in df.columns:
213
  return None, f"Column '{places_column}' not found in the Excel file. Available columns: {', '.join(df.columns)}", None
 
297
  </style>
298
  """
299
 
300
+ with gr.Blocks(css=custom_css, title="Daten Strukturieren und Analysieren") as demo:
301
  gr.HTML("""
302
  <div style="text-align: center; margin-bottom: 1rem">
303
  <h1>Historical Data Analysis Tools</h1>
304
+ <p style="font-size: 1.1rem; margin-top: -10px;">Dies ist eine Demoversion für die Extrahierung und Visualisierung von Daten</p>
305
  </div>
306
  """)
307
 
 
309
  with gr.TabItem("🔍 Text Extraction"):
310
  gr.HTML("""
311
  <div class="info-box">
312
+ <h3 style="margin-top: 0;">Extrahieren Sie strukturierte Daten aus unstrukturiertem Text</h3>
313
+ <p>Verwenden Sie das Sprachmodell NuExtract-1.5 um automatisch Informationen zu extrahieren.</p>
314
  </div>
315
  """)
316
 
 
322
  lines=5
323
  )
324
  text = gr.Textbox(
325
+ label="Hier unstrukturierten Text einfügen",
326
+ value="Nene Erdbeben in Japan. London, 15. Jan. (Drahtber.) Reuter meldet aus Osaka: Die telephonische Verbindung zwischen Osaka und Tokio ist heute um 5.45 Uhr durch ein Erdbeben unterbrochen worden. Die Straßenbahnen in Tokio liegen still. Der Eisenbahnverkehr Tokio — Osaka ist unterbrochen. Die kaiserliche Familie ist in Sicherheit. In Suvamo, einer Borstadt Tokios, sind Brände ausgebrochen. Ein Eisenbahnzug stürzte in den Bajubawo, einem Fluß zwischen Gotemba und Tokio. Sechs Züge wurden umgeworfen. Nenqork, 15. Jan. (Drahtber.) Aus Tokio wird berichtet, daß in Uokohama bei dem Erdbeben sechs Personen getötet und 22 verletzt wurden. In Tokio wurden vier Personen getötet und 20 verletzt. In Nokohama wurden 800 Häuser zerstört.",
327
  lines=8
328
  )
329
+ extract_btn = gr.Button("Extrahieren Sie Informationen", variant="primary")
330
 
331
  with gr.Column():
332
  status = gr.Textbox(label="Status")
 
338
  outputs=[status, output]
339
  )
340
 
341
+ with gr.TabItem("📍 Mapping von strukturierten Daten"):
342
  gr.HTML("""
343
  <div class="info-box">
344
+ <h3 style="margin-top: 0;">Visualisieren Sie Daten auf Karten</h3>
345
+ <p>Lade eine Excel-Tabelle hoch und erstelle eine interaktive Karte.</p>
346
  </div>
347
  """)
348
 
 
354
  elem_classes="file-upload-box"
355
  )
356
  places_column = gr.Textbox(
357
+ label="Name der Tabellenspalte mit Ortsname",
358
+ value="earthquake_location",
359
+ placeholder="Füge den Namen der Spalte mit den Orten ein"
360
  )
361
+ process_btn = gr.Button("Erstellen Sie die Karte", variant="primary")
362
 
363
  with gr.Column():
364
  map_output = gr.HTML(
365
+ label="Interaktive Karte",
366
  value="""
367
  <div style="text-align:center; height:35vh; width:100%; display:flex; align-items:center; justify-content:center;
368
  background-color:#f5f5f5; border:1px solid #e0e0e0; border-radius:8px;">
 
375
  elem_id="map-container"
376
  )
377
  stats_output = gr.Textbox(
378
+ label="Status",
379
  lines=2,
380
  elem_classes="stats-box"
381
  )
382
  processed_file = gr.File(
383
+ label="Bearbeitete Daten herunterladen",
384
  visible=True,
385
  interactive=False
386
  )
387
 
388
  def process_and_map(file, column):
389
  if file is None:
390
+ return None, "Hier bitte die Excel-Tabelle hochladen", None
391
 
392
  try:
393
  map_html, stats, processed_path = process_excel(file, column)