Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -23,6 +23,17 @@ custom_css = """
|
|
23 |
api_key = os.getenv('groq')
|
24 |
client = groq.Client(api_key=api_key)
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
def llm(message):
|
27 |
message = f"return a json object with the keys: name,email,phone,website \n the values can be found here, leave blank if value is not available:\n {message} \n return a json object only. no text, no explanaition"
|
28 |
try:
|
@@ -93,19 +104,19 @@ def process_ort(ort):
|
|
93 |
#vereine.append(contact_detailes)
|
94 |
vereine.append(json_object)
|
95 |
|
|
|
96 |
# Convert JSON string to Python dictionary
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
return vereine
|
102 |
|
103 |
-
|
104 |
# Create the Gradio interface
|
105 |
with gr.Blocks(css=custom_css) as demo:
|
106 |
with gr.Row():
|
107 |
-
|
108 |
-
details_output = gr.Textbox(label="Ausgabe", value = f"\n\n\n\n")
|
109 |
with gr.Row():
|
110 |
ort_input = gr.Textbox(label="prompt", placeholder="ask anything...")
|
111 |
with gr.Row():
|
|
|
23 |
api_key = os.getenv('groq')
|
24 |
client = groq.Client(api_key=api_key)
|
25 |
|
26 |
+
|
27 |
+
def qwen(jsondata):
|
28 |
+
client = Client("Qwen/Qwen2.5-72B-Instruct")
|
29 |
+
result = client.predict(
|
30 |
+
query= f"return a valid json object \n {jsondata}",
|
31 |
+
history=[],
|
32 |
+
system="You are Qwen, created by Alibaba Cloud. You are a helpful assistant.",
|
33 |
+
api_name="/model_chat"
|
34 |
+
)
|
35 |
+
return result
|
36 |
+
|
37 |
def llm(message):
|
38 |
message = f"return a json object with the keys: name,email,phone,website \n the values can be found here, leave blank if value is not available:\n {message} \n return a json object only. no text, no explanaition"
|
39 |
try:
|
|
|
104 |
#vereine.append(contact_detailes)
|
105 |
vereine.append(json_object)
|
106 |
|
107 |
+
valid_json = qwen(vereine)
|
108 |
# Convert JSON string to Python dictionary
|
109 |
+
data_dict = json.loads(valid_json)
|
110 |
+
Convert dictionary to DataFrame
|
111 |
+
df = pd.DataFrame(data_dict)
|
112 |
+
return df
|
113 |
return vereine
|
114 |
|
|
|
115 |
# Create the Gradio interface
|
116 |
with gr.Blocks(css=custom_css) as demo:
|
117 |
with gr.Row():
|
118 |
+
details_output = gr.DataFrame(label="answer", elem_id="md")
|
119 |
+
#details_output = gr.Textbox(label="Ausgabe", value = f"\n\n\n\n")
|
120 |
with gr.Row():
|
121 |
ort_input = gr.Textbox(label="prompt", placeholder="ask anything...")
|
122 |
with gr.Row():
|