Khachatur Mirijanyan commited on
Commit ·
f8b0fab
1
Parent(s): 8380f74
raw app
Browse files- app.py +25 -1
- requirements.txt +2 -0
app.py
CHANGED
|
@@ -1 +1,25 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from langchain import SQLDatabaseChain
|
| 2 |
+
from langchain.sql_database import SQLDatabase
|
| 3 |
+
from langchain.llms.openai import OpenAI
|
| 4 |
+
from langchain.chat_models import ChatOpenAI
|
| 5 |
+
from langchain.prompts.prompt import PromptTemplate
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
def answer_question(query):
|
| 9 |
+
|
| 10 |
+
return("DONE: " + query)
|
| 11 |
+
|
| 12 |
+
if __name__ == "__main__":
|
| 13 |
+
import gradio as gr
|
| 14 |
+
# print(answer_question("Who is Harry's Father"))
|
| 15 |
+
|
| 16 |
+
gr.Interface(
|
| 17 |
+
answer_question,
|
| 18 |
+
[
|
| 19 |
+
gr.inputs.Textbox(lines=2, label="Query"),
|
| 20 |
+
],
|
| 21 |
+
gr.outputs.Textbox(label="Response"),
|
| 22 |
+
title="Ask Harry Potter",
|
| 23 |
+
description=""" Ask Harry Potter is a tool that let's you ask a question with
|
| 24 |
+
the books' text as reference"""
|
| 25 |
+
).launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
openai
|
| 2 |
+
langchain
|