Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import os
|
3 |
+
import requests
|
4 |
+
|
5 |
+
HF_API_URL = "https://api-inference.huggingface.co/models/YOUR_MODEL"
|
6 |
+
HF_API_TOKEN = os.getenv("HF_API_TOKEN")
|
7 |
+
|
8 |
+
headers = {"Authorization": f"Bearer {HF_API_TOKEN}"}
|
9 |
+
|
10 |
+
st.title("Missed Call AI Assistant")
|
11 |
+
|
12 |
+
user_input = st.text_input("Enter message:")
|
13 |
+
|
14 |
+
if st.button("Get Response"):
|
15 |
+
if user_input:
|
16 |
+
payload = {"inputs": user_input}
|
17 |
+
response = requests.post(HF_API_URL, headers=headers, json=payload)
|
18 |
+
if response.status_code == 200:
|
19 |
+
st.write("AI Response:", response.json()[0]['generated_text'])
|
20 |
+
else:
|
21 |
+
st.write("Error:", response.text)
|