Update app.py
Browse files
app.py
CHANGED
|
@@ -12,7 +12,6 @@ For more information on `huggingface_hub` Inference API support, please check th
|
|
| 12 |
"""
|
| 13 |
|
| 14 |
model_name = "llama-3.3-70b-versatile"
|
| 15 |
-
groq_api_key = "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"
|
| 16 |
groq_chat = ChatGroq(groq_api_key=groq_api_key, model_name=model_name)
|
| 17 |
embeddings = HuggingFaceEmbeddings(
|
| 18 |
model_name = "pkshatech/GLuCoSE-base-ja"
|
|
@@ -23,7 +22,7 @@ vector_store = InMemoryVectorStore.load(
|
|
| 23 |
retriever = vector_store.as_retriever(search_kwargs={"k": 4})
|
| 24 |
|
| 25 |
|
| 26 |
-
def fetch_response(user_input):
|
| 27 |
chat = ChatGroq(
|
| 28 |
api_key = groq_api_key,
|
| 29 |
model_name = model_name
|
|
@@ -57,6 +56,8 @@ with gr.Blocks() as demo:
|
|
| 57 |
gr.Markdown('''# SOP事業マスター \n
|
| 58 |
SOP作成研究に関して、公募要領やQAを参考にRAGを使って回答します。
|
| 59 |
''')
|
|
|
|
|
|
|
| 60 |
with gr.Row():
|
| 61 |
with gr.Column():
|
| 62 |
user_input = gr.Textbox(label="User Input")
|
|
@@ -67,7 +68,7 @@ with gr.Blocks() as demo:
|
|
| 67 |
source1 = gr.Textbox(label="回答ソース1")
|
| 68 |
with gr.Column():
|
| 69 |
source2 = gr.Textbox(label="回答ソース2")
|
| 70 |
-
submit.click(fetch_response, inputs=user_input, outputs=[answer, source1, source2])
|
| 71 |
|
| 72 |
if __name__ == "__main__":
|
| 73 |
demo.launch()
|
|
|
|
| 12 |
"""
|
| 13 |
|
| 14 |
model_name = "llama-3.3-70b-versatile"
|
|
|
|
| 15 |
groq_chat = ChatGroq(groq_api_key=groq_api_key, model_name=model_name)
|
| 16 |
embeddings = HuggingFaceEmbeddings(
|
| 17 |
model_name = "pkshatech/GLuCoSE-base-ja"
|
|
|
|
| 22 |
retriever = vector_store.as_retriever(search_kwargs={"k": 4})
|
| 23 |
|
| 24 |
|
| 25 |
+
def fetch_response(groq_api_key, user_input):
|
| 26 |
chat = ChatGroq(
|
| 27 |
api_key = groq_api_key,
|
| 28 |
model_name = model_name
|
|
|
|
| 56 |
gr.Markdown('''# SOP事業マスター \n
|
| 57 |
SOP作成研究に関して、公募要領やQAを参考にRAGを使って回答します。
|
| 58 |
''')
|
| 59 |
+
with gr.Row():
|
| 60 |
+
api_key = gr.Textbox(label="Groq API key")
|
| 61 |
with gr.Row():
|
| 62 |
with gr.Column():
|
| 63 |
user_input = gr.Textbox(label="User Input")
|
|
|
|
| 68 |
source1 = gr.Textbox(label="回答ソース1")
|
| 69 |
with gr.Column():
|
| 70 |
source2 = gr.Textbox(label="回答ソース2")
|
| 71 |
+
submit.click(fetch_response, inputs=[api_key, user_input], outputs=[answer, source1, source2])
|
| 72 |
|
| 73 |
if __name__ == "__main__":
|
| 74 |
demo.launch()
|