Abhilashvj commited on
Commit
7892c4e
Β·
1 Parent(s): dbe9ae4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -1,17 +1,14 @@
1
  import os
2
  import requests
3
- from PIL import Image, ImageDraw, ImageFont
4
  from io import BytesIO
5
  import base64
6
- from utils import image_interface
7
  import streamlit as st
8
- from streamlit_image_select import image_select
9
 
10
  AUTH_TOKEN = st. secrets["AUTH_TOKEN"]
11
 
12
  headers = {"Authorization": f"Bearer {AUTH_TOKEN}"}
13
  st.set_page_config(page_title="Image Similarity", page_icon="πŸŽ†πŸŽ‡")
14
- CHAT_API = "https://abhilashvj-computer-vision-backend.hf.space/"
15
  # IMAGE_SIMILARITY_DEMO = "http://127.0.0.1:8000/find-similar-image-pinecone/"
16
  TMP_DIR = "./tmp"
17
 
@@ -54,6 +51,10 @@ if dynamic_file:
54
  st.header("Chat with Bot")
55
  user_input = st.text_input("Ask your question:")
56
  # Assuming you have an endpoint to send user questions and get responses
57
- response = requests.post(f'{CHAT_API}/ask/', json={"question": user_input})
 
 
 
 
58
  bot_response = response.json().get("answer")
59
  st.text_area("Bot's Response:", value=bot_response)
 
1
  import os
2
  import requests
 
3
  from io import BytesIO
4
  import base64
 
5
  import streamlit as st
 
6
 
7
  AUTH_TOKEN = st. secrets["AUTH_TOKEN"]
8
 
9
  headers = {"Authorization": f"Bearer {AUTH_TOKEN}"}
10
  st.set_page_config(page_title="Image Similarity", page_icon="πŸŽ†πŸŽ‡")
11
+ CHAT_API = "https://abhilashvj-chat-api.hf.space/"
12
  # IMAGE_SIMILARITY_DEMO = "http://127.0.0.1:8000/find-similar-image-pinecone/"
13
  TMP_DIR = "./tmp"
14
 
 
51
  st.header("Chat with Bot")
52
  user_input = st.text_input("Ask your question:")
53
  # Assuming you have an endpoint to send user questions and get responses
54
+ data = {
55
+ "text": user_input,
56
+ "top_k": 5,
57
+ }
58
+ response = requests.post(f'{CHAT_API}/query/', json=data)
59
  bot_response = response.json().get("answer")
60
  st.text_area("Bot's Response:", value=bot_response)