mgokg commited on
Commit
f977046
·
verified ·
1 Parent(s): 70f8d37

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -21
app.py CHANGED
@@ -11,8 +11,6 @@ import pandas as pd
11
  api_key = os.environ.get('GROQ_API_KEY')
12
  read_key = os.environ.get('HF_TOKEN', None)
13
 
14
- df = pd.DataFrame()
15
-
16
 
17
  # Initialize Groq client
18
  if api_key:
@@ -141,7 +139,7 @@ with gr.Blocks() as demo:
141
  with gr.Row():
142
  ort_input = gr.Textbox(label="Ort", placeholder="Gib den Namen des Ortes ein")
143
  with gr.Row():
144
- details_output = gr.Dataframe()
145
 
146
  def process_ort(ort):
147
  links_text, links = parse_links_and_content(ort)
@@ -156,31 +154,18 @@ with gr.Blocks() as demo:
156
  system="you are a expert for json data and your job is to extract information from text and return a valid json object only. no text no explanations",
157
  api_name="/model_chat"
158
  )
159
- #result[1]=gr.Markdown()
160
- #dict_data = json.loads(result[1])
161
- #values = list(result.values())
162
- # Return the value at index 1
163
  json_data =result[1][0][1]
164
- #json_dat = json_data[1]
165
- #json_dat=gr.Markdown()
166
- #return result
167
- #return result[1]
168
  json_data = json_data.replace("```json","")
169
  json_data = json_data.replace("```","")
170
- #json_data = gr.JSON(json_data)
171
- #json_data = json.loads(json_data)
172
- # JSON-Daten in ein DataFrame laden
173
- df = pd.read_json(json_data)
174
- df1 = pd.DataFrame(json_data)
175
  # DataFrame in eine CSV-Datei konvertieren
176
  #df.to_csv('daten.csv', index=False)
177
- return df1
178
  return json_data
179
 
180
-
181
-
182
-
183
-
184
  with gr.Row():
185
  clearbutton = gr.Button("Clear")
186
  button = gr.Button("Senden")
 
11
  api_key = os.environ.get('GROQ_API_KEY')
12
  read_key = os.environ.get('HF_TOKEN', None)
13
 
 
 
14
 
15
  # Initialize Groq client
16
  if api_key:
 
139
  with gr.Row():
140
  ort_input = gr.Textbox(label="Ort", placeholder="Gib den Namen des Ortes ein")
141
  with gr.Row():
142
+ details_output = gr.Textbox()
143
 
144
  def process_ort(ort):
145
  links_text, links = parse_links_and_content(ort)
 
154
  system="you are a expert for json data and your job is to extract information from text and return a valid json object only. no text no explanations",
155
  api_name="/model_chat"
156
  )
157
+
 
 
 
158
  json_data =result[1][0][1]
 
 
 
 
159
  json_data = json_data.replace("```json","")
160
  json_data = json_data.replace("```","")
161
+ json_data = gr.JSON(json_data)
162
+ #df = pd.read_json(json_data)
163
+ #df1 = pd.DataFrame(json_data)
 
 
164
  # DataFrame in eine CSV-Datei konvertieren
165
  #df.to_csv('daten.csv', index=False)
166
+
167
  return json_data
168
 
 
 
 
 
169
  with gr.Row():
170
  clearbutton = gr.Button("Clear")
171
  button = gr.Button("Senden")