mgokg commited on
Commit
ce9fc94
·
verified ·
1 Parent(s): e1ff041

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -4,11 +4,14 @@ from bs4 import BeautifulSoup
4
  from urllib.parse import urljoin
5
  import json
6
 
 
 
7
  def parse_links(prompt):
8
  #anfrage ='fill in the missing contact information. do not reference the json object. do not use html tags inside the json object. it must be valid json. do not return explanaitons or any other text. thanks for your efforts:)'
9
  Name=prompt
10
  anfrage ="""
11
- fill in the missing contact information. do not reference the json object. do not use html tags inside the json object. it must be valid json. do not return explanaitons or any other text. only returm a valid json.object
 
12
  {
13
  "Name": "",
14
  "Email": "",
@@ -17,8 +20,8 @@ def parse_links(prompt):
17
  }
18
  """
19
  try:
20
- url = "http://specialist-it.de:3001/api/search"
21
-
22
  payload = {
23
  "chatModel": {
24
  "provider": "groq",
@@ -75,9 +78,12 @@ with gr.Blocks() as demo:
75
  gr.Markdown("# Perplexica WebSearch")
76
  ort_input = gr.Textbox(label="Prompt", placeholder="prompt", value="Aero Club Bamberg e.V.")
77
  links_output = gr.Textbox(label="Antwort")
78
- # Button zum Starten der Parsung
79
- button = gr.Button("senden")
 
 
80
  # Verbinde den Button mit der Funktion
81
  button.click(fn=parse_links, inputs=ort_input, outputs=links_output)
 
82
 
83
  demo.launch()
 
4
  from urllib.parse import urljoin
5
  import json
6
 
7
+ secreturl = os.environ.get('secret_url')
8
+
9
  def parse_links(prompt):
10
  #anfrage ='fill in the missing contact information. do not reference the json object. do not use html tags inside the json object. it must be valid json. do not return explanaitons or any other text. thanks for your efforts:)'
11
  Name=prompt
12
  anfrage ="""
13
+ [role:system, content:you are a json expert and your job is extracting information from text, generating valid json and return a json object only. do not return any text. halte dich an das vorgegebene json schema]
14
+ [role:user, content: fill in the missing contact information. do not reference the json object. do not use html tags inside the json object. it must be valid json. do not return explanaitons or any other text. only returm a valid json.object
15
  {
16
  "Name": "",
17
  "Email": "",
 
20
  }
21
  """
22
  try:
23
+ #url = "http://specialist-it.de:3001/api/search"
24
+ url = "secreturl"
25
  payload = {
26
  "chatModel": {
27
  "provider": "groq",
 
78
  gr.Markdown("# Perplexica WebSearch")
79
  ort_input = gr.Textbox(label="Prompt", placeholder="prompt", value="Aero Club Bamberg e.V.")
80
  links_output = gr.Textbox(label="Antwort")
81
+ with gr.Row():
82
+ clearbutton = gr.Button("clear")
83
+ # Button zum Starten der Parsung
84
+ button = gr.Button("senden")
85
  # Verbinde den Button mit der Funktion
86
  button.click(fn=parse_links, inputs=ort_input, outputs=links_output)
87
+ clearbutton.click(inputs=[], outputs=[])
88
 
89
  demo.launch()