Spaces:
Runtime error
Runtime error
ghus75
commited on
Commit
·
ea3fa97
1
Parent(s):
533929c
import prompts from private github repo
Browse files- .ipynb_checkpoints/app-checkpoint.py +8 -0
- app.py +11 -1
- requirements.txt +2 -1
.ipynb_checkpoints/app-checkpoint.py
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
HF_Hub_API_token = os.environ.get('HF_Hub_API_token', None)
|
| 5 |
+
import gradio as gr
|
| 6 |
+
|
| 7 |
+
demo = gr.load("gaelhuser/patent_gen_prv", hf_token=HF_Hub_API_token, src="spaces")
|
| 8 |
+
demo.launch()
|
app.py
CHANGED
|
@@ -17,6 +17,7 @@ from langchain.memory import ConversationBufferWindowMemory
|
|
| 17 |
|
| 18 |
import os
|
| 19 |
HF_Hub_API_token = os.environ.get('HF_Hub_API_token', None)
|
|
|
|
| 20 |
|
| 21 |
llm = HuggingFaceEndpoint(
|
| 22 |
repo_id="mistralai/Mistral-7B-Instruct-v0.2",
|
|
@@ -30,7 +31,15 @@ llm = HuggingFaceEndpoint(
|
|
| 30 |
memory = ConversationBufferMemory()
|
| 31 |
conversation = ConversationChain(llm=llm, verbose=False, memory=memory)
|
| 32 |
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
patent_draft = [] # shared between all users !!
|
| 36 |
trim = False#True
|
|
@@ -176,3 +185,4 @@ with gr.Blocks() as demo:
|
|
| 176 |
|
| 177 |
demo.queue().launch()
|
| 178 |
|
|
|
|
|
|
| 17 |
|
| 18 |
import os
|
| 19 |
HF_Hub_API_token = os.environ.get('HF_Hub_API_token', None)
|
| 20 |
+
github_token = os.environ.get('github_token', None)
|
| 21 |
|
| 22 |
llm = HuggingFaceEndpoint(
|
| 23 |
repo_id="mistralai/Mistral-7B-Instruct-v0.2",
|
|
|
|
| 31 |
memory = ConversationBufferMemory()
|
| 32 |
conversation = ConversationChain(llm=llm, verbose=False, memory=memory)
|
| 33 |
|
| 34 |
+
|
| 35 |
+
# import remote
|
| 36 |
+
from git import Repo
|
| 37 |
+
|
| 38 |
+
if not os.path.exists('repo_directory'):
|
| 39 |
+
Repo.clone_from(f'https://ghus75:{github_token}@github.com/ghus75/patent_gen.git', 'repo_directory' )
|
| 40 |
+
|
| 41 |
+
from repo_directory.gen_prompts import *
|
| 42 |
+
|
| 43 |
|
| 44 |
patent_draft = [] # shared between all users !!
|
| 45 |
trim = False#True
|
|
|
|
| 185 |
|
| 186 |
demo.queue().launch()
|
| 187 |
|
| 188 |
+
|
requirements.txt
CHANGED
|
@@ -1,3 +1,4 @@
|
|
| 1 |
langchain
|
| 2 |
langchain-core
|
| 3 |
-
langchain-huggingface
|
|
|
|
|
|
| 1 |
langchain
|
| 2 |
langchain-core
|
| 3 |
+
langchain-huggingface
|
| 4 |
+
GitPython
|