Spaces:
Sleeping
Sleeping
AliHaider0343
commited on
Commit
•
e6bde82
1
Parent(s):
806900f
Update app.py
Browse files
app.py
CHANGED
@@ -54,8 +54,14 @@ def Get_Inference(text_input):
|
|
54 |
# Generate the prompt with the text input
|
55 |
formatted_prompt = prompt.format(format_instructions=format_instructions, text=text_input)
|
56 |
# Send the prompt to the LLM and get the response
|
57 |
-
response = llm.invoke(formatted_prompt) # Pass a list with a single prompt string
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
|
60 |
|
61 |
|
@@ -81,7 +87,10 @@ if sentence:
|
|
81 |
results = Get_Inference(sentence)
|
82 |
if len(results) > 0:
|
83 |
st.write("Customer/Sales Inference:")
|
84 |
-
st.write(results)
|
|
|
|
|
|
|
85 |
else:
|
86 |
st.write("No Inference Available.")
|
87 |
|
|
|
54 |
# Generate the prompt with the text input
|
55 |
formatted_prompt = prompt.format(format_instructions=format_instructions, text=text_input)
|
56 |
# Send the prompt to the LLM and get the response
|
57 |
+
response = llm.invoke(formatted_prompt) # Pass a list with a single prompt string
|
58 |
+
data = json.loads(str(response.content).replace('\n','').replace('\t','').replace('json','').replace('`',''))
|
59 |
+
# Access individual values
|
60 |
+
order_placed = data["Order Placed"]
|
61 |
+
reason = data["Reason"]
|
62 |
+
customer_feedback = data["Customer Feedback"]
|
63 |
+
demands = data["Demands"]
|
64 |
+
return order_placed,reason,customer_feedback,demands
|
65 |
|
66 |
|
67 |
|
|
|
87 |
results = Get_Inference(sentence)
|
88 |
if len(results) > 0:
|
89 |
st.write("Customer/Sales Inference:")
|
90 |
+
st.write('Order Placed : ',results[0])
|
91 |
+
st.write('Reason : ',results[1])
|
92 |
+
st.write('Feedback : ',results[2])
|
93 |
+
st.write('Demand : ',results[3])
|
94 |
else:
|
95 |
st.write("No Inference Available.")
|
96 |
|