Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,15 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
from epub2txt import epub2txt
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
class GUI:
|
5 |
def __init__(self, *args, **kwargs):
|
6 |
with gr.Blocks() as demo:
|
@@ -20,8 +29,9 @@ class GUI:
|
|
20 |
chapter_titles = epub2txt.content_titles
|
21 |
title = epub2txt.title
|
22 |
return gr.update(
|
23 |
-
value=f"# {title}\n\n" +
|
24 |
-
|
|
|
25 |
|
26 |
def hello(self, profile: gr.OAuthProfile | None):
|
27 |
if profile is None:
|
|
|
1 |
+
import os
|
2 |
import gradio as gr
|
3 |
from epub2txt import epub2txt
|
4 |
|
5 |
+
os.system("git clone --recurse-submodules https://github.com/ztxz16/fastllm.git")
|
6 |
+
os.system("cd fastllm; mkdir build; cd build; cmake ..; make -j; cd tools; python setup.py install")
|
7 |
+
os.system("wget https://huggingface.co/huangyuyang/chatglm2-6b-int4.flm/resolve/main/chatglm2-6b-int4.flm")
|
8 |
+
|
9 |
+
from fastllm_pytools import llm
|
10 |
+
model = llm.model("./chatglm2-6b-int4.flm")
|
11 |
+
prompt = os.getenv("prompt")
|
12 |
+
|
13 |
class GUI:
|
14 |
def __init__(self, *args, **kwargs):
|
15 |
with gr.Blocks() as demo:
|
|
|
29 |
chapter_titles = epub2txt.content_titles
|
30 |
title = epub2txt.title
|
31 |
return gr.update(
|
32 |
+
value=f"# {title}\n\n" + model.response(prompt+ch_list[2]))
|
33 |
+
# value=f"# {title}\n\n" + "\n\n".join(
|
34 |
+
# [f"## {ct}\n\n{c}" for ct, c in zip(chapter_titles, ch_list)]))
|
35 |
|
36 |
def hello(self, profile: gr.OAuthProfile | None):
|
37 |
if profile is None:
|