Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pandas as pd
|
2 |
+
from pandasai import SmartDataframe
|
3 |
+
from pandasai.llm import OpenAI
|
4 |
+
import os
|
5 |
+
from pandasai.llm import Starcoder, Falcon
|
6 |
+
import gradio as gr
|
7 |
+
from function import initiate_process
|
8 |
+
import tempfile
|
9 |
+
|
10 |
+
def chatbot(file_upload,message):
|
11 |
+
file_path = file_upload.name
|
12 |
+
print(file_path)
|
13 |
+
extention = file_path.split(".")[1]
|
14 |
+
print(extention)
|
15 |
+
output = initiate_process(file_path,extention,message)
|
16 |
+
if type(output) == str:
|
17 |
+
path = "/home/aiuser/sumukh/Analyze-Data/analyze_final/empty.jpg"
|
18 |
+
else:
|
19 |
+
path = "/home/aiuser/sumukh/Analyze-Data/analyze_final/temp_chart.png"
|
20 |
+
return output,path
|
21 |
+
|
22 |
+
demo = gr.Interface(fn=chatbot, inputs = ['file','text'], outputs = ['text','image'])
|
23 |
+
demo.queue(max_size=20)
|
24 |
+
demo.launch(server_name="0.0.0.0",server_port=7870,debug=True)
|