SergeyO7 commited on
Commit
a7234c5
·
verified ·
1 Parent(s): 0571c9d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -24
app.py CHANGED
@@ -19,6 +19,7 @@ from io import BytesIO
19
  from PIL import Image
20
  from opentelemetry.sdk.trace import TracerProvider
21
  from openinference.instrumentation.smolagents import SmolagentsInstrumentor
 
22
  from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
23
  from opentelemetry.sdk.trace.export import SimpleSpanProcessor
24
 
@@ -367,30 +368,14 @@ def chat_interface(query_text):
367
  return f"Критическая ошибка: {str(e)}", None
368
 
369
  # Define Gradio Interface
370
- #interface = gr.Interface(
371
- # fn=chat_interface,
372
- # inputs=gr.Textbox(lines=2, placeholder="Введите ваш вопрос здесь..."),
373
- # outputs=[gr.Textbox(), gr.Image()],
374
- # title="Чат с документами",
375
- # description="Задайте вопрос, и я отвечу на основе книги Павла Глобы "Планетарная Лестница". "
376
- # "Для быстрого запроса трактовки планетарной лестницы используйте формат: PLadder DD-MM-YYYY HH:MM:SS место"
377
- #)
378
-
379
- # UI layout with Gradio Blocks
380
- with gr.Blocks() as interface:
381
- with gr.Row():
382
- with gr.Column(scale=2):
383
- output_text = gr.Textbox(label="Response", lines=10)
384
- with gr.Column(scale=1):
385
- output_image = gr.Image(label="Planetary Ladder Plot")
386
- with gr.Row():
387
- query_text = gr.Textbox(label="Query", placeholder="e.g., PLadder 2023-10-10 12:00")
388
- location_lat = gr.Textbox(label="Latitude", placeholder="e.g., 37.7749")
389
- location_lon = gr.Textbox(label="Longitude", placeholder="e.g., -122.4194")
390
-
391
- query_text.submit(chat_interface,
392
- inputs=[query_text, location_lat, location_lon],
393
- outputs=[output_text, output_image])
394
 
395
 
396
  if __name__ == "__main__":
 
19
  from PIL import Image
20
  from opentelemetry.sdk.trace import TracerProvider
21
  from openinference.instrumentation.smolagents import SmolagentsInstrumentor
22
+
23
  from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
24
  from opentelemetry.sdk.trace.export import SimpleSpanProcessor
25
 
 
368
  return f"Критическая ошибка: {str(e)}", None
369
 
370
  # Define Gradio Interface
371
+ interface = gr.Interface(
372
+ fn=chat_interface,
373
+ inputs=gr.Textbox(lines=2, placeholder="Введите ваш вопрос здесь..."),
374
+ outputs=[gr.Textbox(), gr.Image()],
375
+ title="Чат с документами",
376
+ description="Задайте вопрос, и я отвечу на основе книги Павла Глобы "Планетарная Лестница". "
377
+ "Для быстрого запроса трактовки планетарной лестницы используйте формат: PLadder DD-MM-YYYY HH:MM:SS место"
378
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
379
 
380
 
381
  if __name__ == "__main__":