Spaces:
Runtime error
Runtime error
Commit
·
b874666
1
Parent(s):
d43825c
update gptfake
Browse files
app.py
CHANGED
@@ -40,7 +40,7 @@ import gradio as gr
|
|
40 |
import time
|
41 |
|
42 |
import glob
|
43 |
-
from typing import List
|
44 |
from multiprocessing import Pool
|
45 |
from tqdm import tqdm
|
46 |
from pygame import mixer
|
@@ -65,9 +65,35 @@ import langchain
|
|
65 |
import asyncio
|
66 |
from playwright.async_api import async_playwright
|
67 |
|
|
|
68 |
|
|
|
|
|
69 |
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
|
72 |
|
73 |
async def start_playwright(question: str):
|
@@ -495,11 +521,9 @@ chat = AzureChatOpenAI(
|
|
495 |
)
|
496 |
|
497 |
|
|
|
498 |
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
llm = chat
|
503 |
|
504 |
llm_math = LLMMathChain.from_llm(llm)
|
505 |
|
|
|
40 |
import time
|
41 |
|
42 |
import glob
|
43 |
+
from typing import Any, List, Mapping, Optional
|
44 |
from multiprocessing import Pool
|
45 |
from tqdm import tqdm
|
46 |
from pygame import mixer
|
|
|
65 |
import asyncio
|
66 |
from playwright.async_api import async_playwright
|
67 |
|
68 |
+
from langchain.embeddings.huggingface import HuggingFaceEmbeddings
|
69 |
|
70 |
+
from langchain.llms.base import LLM
|
71 |
+
from langchain.callbacks.manager import CallbackManagerForLLMRun
|
72 |
|
73 |
+
|
74 |
+
class GPTRemote(LLM):
|
75 |
+
n = 0
|
76 |
+
|
77 |
+
@property
|
78 |
+
def _llm_type(self) -> str:
|
79 |
+
return "custom"
|
80 |
+
|
81 |
+
def _call(
|
82 |
+
self,
|
83 |
+
prompt: str,
|
84 |
+
stop: Optional [List[str]] = None,
|
85 |
+
run_manager: Optional[CallbackManagerForLLMRun] = None,
|
86 |
+
**kwargs: Any
|
87 |
+
) -> str:
|
88 |
+
print("prompt", prompt)
|
89 |
+
output = "test custom llm"
|
90 |
+
return output
|
91 |
+
|
92 |
+
@property
|
93 |
+
def _identifying_params(self) -> Mapping[str, Any]:
|
94 |
+
return {"input", self.n}
|
95 |
+
|
96 |
+
GPTfake = GPTRemote()
|
97 |
|
98 |
|
99 |
async def start_playwright(question: str):
|
|
|
521 |
)
|
522 |
|
523 |
|
524 |
+
# llm = chat
|
525 |
|
526 |
+
llm = GPTfake
|
|
|
|
|
|
|
527 |
|
528 |
llm_math = LLMMathChain.from_llm(llm)
|
529 |
|