Spaces:
Runtime error
Runtime error
Commit
·
d668da6
1
Parent(s):
338c179
Upload folder using huggingface_hub
Browse files- README.md +3 -9
- app.py +19 -0
- index.json +0 -0
- requirements.txt +5 -0
README.md
CHANGED
|
@@ -1,12 +1,6 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji: 🌖
|
| 4 |
-
colorFrom: gray
|
| 5 |
-
colorTo: indigo
|
| 6 |
-
sdk: gradio
|
| 7 |
-
sdk_version: 4.11.0
|
| 8 |
app_file: app.py
|
| 9 |
-
|
|
|
|
| 10 |
---
|
| 11 |
-
|
| 12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: UnCut_Assistant
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
app_file: app.py
|
| 4 |
+
sdk: gradio
|
| 5 |
+
sdk_version: 3.40.1
|
| 6 |
---
|
|
|
|
|
|
app.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from gpt_index import SimpleDirectoryReader, GPTListIndex, GPTSimpleVectorIndex, LLMPredictor, PromptHelper
|
| 2 |
+
from langchain.chat_models import ChatOpenAI
|
| 3 |
+
import gradio as gr
|
| 4 |
+
import sys
|
| 5 |
+
import os
|
| 6 |
+
|
| 7 |
+
os.environ["OPENAI_API_KEY"] = os.getenv("OPENAI_API_KEY")
|
| 8 |
+
|
| 9 |
+
def chatbot(input_text):
|
| 10 |
+
index = GPTSimpleVectorIndex.load_from_disk('index.json')
|
| 11 |
+
prompt = "Your task is to select top 3 most compatible roles based of the list of the roles from the documents for the person with following skills and appearance: " + input_text + ". Provide the results in JSON format and explain your choice for each selection in separate field for each JSON record"
|
| 12 |
+
response = index.query(prompt)
|
| 13 |
+
return response.response
|
| 14 |
+
|
| 15 |
+
iface = gr.Interface(fn=chatbot,
|
| 16 |
+
inputs=gr.components.Textbox(lines=5, label="Desribe the actor's skills and appearance", show_copy_button=True),
|
| 17 |
+
outputs=gr.components.Textbox(lines=5, label="Most compatible roles", show_copy_button=True),
|
| 18 |
+
title="UnCut Assistant")
|
| 19 |
+
iface.launch()
|
index.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
requirements.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gpt_index==0.4.24
|
| 2 |
+
langchain==0.0.118
|
| 3 |
+
PyPDF2==3.0.1
|
| 4 |
+
pycryptodome==3.18.0
|
| 5 |
+
docx2txt==0.8
|