artificialguybr commited on
Commit
f018bbf
·
1 Parent(s): a5dd2fe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -9
app.py CHANGED
@@ -25,7 +25,6 @@ def generate_knowledge_graph(api_key, user_input):
25
  user_input = scrape_text_from_url(user_input)
26
 
27
  # Chamar a API da OpenAI
28
- print("Chamando a API da OpenAI...")
29
  completion = openai.ChatCompletion.create(
30
  model="gpt-3.5-turbo-16k",
31
  messages=[
@@ -103,9 +102,6 @@ def generate_knowledge_graph(api_key, user_input):
103
  )
104
 
105
  response_data = completion.choices[0]["message"]["function_call"]["arguments"]
106
- print(response_data)
107
- print("Type of response_data:", type(response_data))
108
- print("Value of response_data:", response_data)
109
 
110
  # Convert to dictionary if it's a string
111
  if isinstance(response_data, str):
@@ -130,12 +126,9 @@ def generate_knowledge_graph(api_key, user_input):
130
  dot.edge(edge["from"], edge["to"], label=edge["relationship"], color=edge.get("color", "black"))
131
 
132
  # Renderizar para o formato PNG
133
- print("Renderizando o gráfico para o formato PNG...")
134
  image_data = dot.pipe()
135
  image = Image.open(io.BytesIO(image_data))
136
 
137
- print("Gráfico gerado com sucesso!")
138
-
139
  return image
140
 
141
  # Define a title and description for the Gradio interface using Markdown
@@ -163,6 +156,4 @@ iface = gr.Interface(
163
 
164
  # Enable queueing system for multiple users
165
  iface.queue(concurrency_count=10)
166
-
167
- print("Iniciando a interface Gradio...")
168
  iface.launch()
 
25
  user_input = scrape_text_from_url(user_input)
26
 
27
  # Chamar a API da OpenAI
 
28
  completion = openai.ChatCompletion.create(
29
  model="gpt-3.5-turbo-16k",
30
  messages=[
 
102
  )
103
 
104
  response_data = completion.choices[0]["message"]["function_call"]["arguments"]
 
 
 
105
 
106
  # Convert to dictionary if it's a string
107
  if isinstance(response_data, str):
 
126
  dot.edge(edge["from"], edge["to"], label=edge["relationship"], color=edge.get("color", "black"))
127
 
128
  # Renderizar para o formato PNG
 
129
  image_data = dot.pipe()
130
  image = Image.open(io.BytesIO(image_data))
131
 
 
 
132
  return image
133
 
134
  # Define a title and description for the Gradio interface using Markdown
 
156
 
157
  # Enable queueing system for multiple users
158
  iface.queue(concurrency_count=10)
 
 
159
  iface.launch()