Spaces:
Sleeping
Sleeping
replaced with Streamlit.
Browse files
app.py
CHANGED
@@ -4,6 +4,7 @@ from langchain.text_splitter import CharacterTextSplitter
|
|
4 |
from langchain.chains.question_answering import load_qa_chain
|
5 |
from langchain.llms import OpenAI
|
6 |
import os
|
|
|
7 |
|
8 |
with open("guide1.txt") as f:
|
9 |
hitchhikersguide = f.read()
|
@@ -21,16 +22,12 @@ def make_inference(query):
|
|
21 |
docs = docsearch.get_relevant_documents(query)
|
22 |
return(chain.run(input_documents=docs, question=query))
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
gr.outputs.Textbox(label="Response"),
|
34 |
-
title="🗣️TalkToMyDoc📄",
|
35 |
-
description="🗣️TalkToMyDoc📄 is a tool that allows you to ask questions about a document. In this case - Hitch Hitchhiker's Guide to the Galaxy.",
|
36 |
-
).launch()
|
|
|
4 |
from langchain.chains.question_answering import load_qa_chain
|
5 |
from langchain.llms import OpenAI
|
6 |
import os
|
7 |
+
import streamlit as st
|
8 |
|
9 |
with open("guide1.txt") as f:
|
10 |
hitchhikersguide = f.read()
|
|
|
22 |
docs = docsearch.get_relevant_documents(query)
|
23 |
return(chain.run(input_documents=docs, question=query))
|
24 |
|
25 |
+
|
26 |
+
# Title of the web application
|
27 |
+
st.title('🗣️TalkToMyDoc📄')
|
28 |
+
|
29 |
+
# Text input widget
|
30 |
+
user_input = st.text_input('Enter a query:', '')
|
31 |
+
|
32 |
+
# Displaying output directly below the input field
|
33 |
+
st.write('Answer:', make_inference(user_input))
|
|
|
|
|
|
|
|