Spaces:
Sleeping
Sleeping
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -1,14 +1,15 @@
|
|
| 1 |
import threading
|
| 2 |
import streamlit as st
|
|
|
|
| 3 |
from scripts.api import start_api_server
|
| 4 |
import os
|
| 5 |
# Start the API server in a separate thread
|
| 6 |
api_thread = threading.Thread(target=start_api_server)
|
| 7 |
api_thread.start()
|
| 8 |
-
import requests
|
| 9 |
|
| 10 |
# Use localhost as FastAPI and Streamlit run in the same environment on Spaces
|
| 11 |
-
|
|
|
|
| 12 |
|
| 13 |
st.title("Prompt Search App")
|
| 14 |
st.write("Enter a query below to find similar prompts.")
|
|
|
|
| 1 |
import threading
|
| 2 |
import streamlit as st
|
| 3 |
+
import requests
|
| 4 |
from scripts.api import start_api_server
|
| 5 |
import os
|
| 6 |
# Start the API server in a separate thread
|
| 7 |
api_thread = threading.Thread(target=start_api_server)
|
| 8 |
api_thread.start()
|
|
|
|
| 9 |
|
| 10 |
# Use localhost as FastAPI and Streamlit run in the same environment on Spaces
|
| 11 |
+
API_PORT = os.getenv("PORT", "7860")
|
| 12 |
+
API_URL = f"http://localhost:{API_PORT}/search"
|
| 13 |
|
| 14 |
st.title("Prompt Search App")
|
| 15 |
st.write("Enter a query below to find similar prompts.")
|