Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from websearching import web_search
|
| 3 |
+
from llama_cpp_inf import run_inference_lcpp
|
| 4 |
+
|
| 5 |
+
def reply(query):
|
| 6 |
+
jsonstr = web_search(query)
|
| 7 |
+
results = run_inference_lcpp(jsonstr, query)
|
| 8 |
+
return results
|
| 9 |
+
|
| 10 |
+
st.set_page_config(page_title="SearchPhi", page_icon="🔎")
|
| 11 |
+
# Title of the web app
|
| 12 |
+
st.title("SearchPhi🔎")
|
| 13 |
+
st.subheader("With llama.cpp!🦙")
|
| 14 |
+
# Input text box for the search query
|
| 15 |
+
query = st.text_input("Enter search term:")
|
| 16 |
+
|
| 17 |
+
# Number of results to display
|
| 18 |
+
num_results = st.number_input("Number of results to display:", min_value=1, max_value=5, value=3)
|
| 19 |
+
|
| 20 |
+
# Button to initiate search
|
| 21 |
+
if st.button("Search"):
|
| 22 |
+
if query:
|
| 23 |
+
results = reply(query)
|
| 24 |
+
st.write(f"**Results for '{query}':**")
|
| 25 |
+
st.write_stream(results)
|
| 26 |
+
else:
|
| 27 |
+
st.write("Please enter a search term.")
|