Spaces:
Running
Running
in-app documents
Browse files- .litng.gradio.sh +1 -1
- app.py +27 -6
- config.py +1 -1
.litng.gradio.sh
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
#!/bin/bash
|
2 |
pip install -U "gradio>=4,<=5"
|
3 |
-
GRADIO_SERVER_PORT=7860 gradio app.py --watch-dirs .
|
|
|
1 |
#!/bin/bash
|
2 |
pip install -U "gradio>=4,<=5"
|
3 |
+
GRADIO_SERVER_PORT=7860 gradio app.py --demo-name app --watch-dirs .
|
app.py
CHANGED
@@ -150,16 +150,35 @@ with gr.Blocks(
|
|
150 |
) as app:
|
151 |
intro = f"""# {DEMO_TITLE}
|
152 |
> You provide job description and résumé, and I write Cover letter for you!
|
153 |
-
|
154 |
"""
|
155 |
gr.Markdown(intro)
|
156 |
-
with gr.Accordion("
|
157 |
guide = gr.Markdown("""## Setup
|
158 |
-
`API Key`: If you have no idea, go to https://beta.openai.com/account/api-keys
|
159 |
|
160 |
-
|
161 |
-
|
162 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
""")
|
164 |
with gr.Row():
|
165 |
with gr.Column(scale=1):
|
@@ -239,6 +258,8 @@ with gr.Blocks(
|
|
239 |
strong_model,
|
240 |
],
|
241 |
outputs=[strong_base, strong_key, strong_model],
|
|
|
|
|
242 |
)
|
243 |
|
244 |
infer_btn.click(
|
|
|
150 |
) as app:
|
151 |
intro = f"""# {DEMO_TITLE}
|
152 |
> You provide job description and résumé, and I write Cover letter for you!
|
153 |
+
|
154 |
"""
|
155 |
gr.Markdown(intro)
|
156 |
+
with gr.Accordion("READ ME FIRST", open=False):
|
157 |
guide = gr.Markdown("""## Setup
|
|
|
158 |
|
159 |
+
> Expand "AI Setup" panel and setup API for 2 AI agents, **CheapAI** and **StrongAI**, before you start.
|
160 |
+
|
161 |
+
+ `API Key`: If you have no idea, go to https://beta.openai.com/account/api-keys
|
162 |
+
|
163 |
+
+ `Model ID`:
|
164 |
+
- **CheapAI**:
|
165 |
+
+ `gpt-3.5-turbo-*` should be fine if OpenAI won't make them lazier and dumber.
|
166 |
+
+ `Mistral-7B-Instruct-v0.1` works well
|
167 |
+
+ `gemma-7b-it` usually can't understand instructions properly and cause error.
|
168 |
+
- **StrongAI**:
|
169 |
+
+`Mistral-7B-Instruct-v0.1` can do the job.
|
170 |
+
+ Models with small context window size like won't work, such as
|
171 |
+
- `gpt-3.5-turbo-0613`
|
172 |
+
- perhaps `gpt-4-0613`
|
173 |
+
|
174 |
+
Model choice can be a interesting topic involing quite a few experiments. Feel free to try any other models you like!
|
175 |
+
|
176 |
+
## Troubleshooting
|
177 |
+
- If your API is on localhost / local network, you may need to run this app on local network too.
|
178 |
+
- If your API is on some AI service platform, review if you have enough balance / credits / quota on the platform.
|
179 |
+
- If you are sure that you have set up the API correctly, but encounter an error along the way, try click the "Go!" button again.
|
180 |
+
- Try change AI provider / model
|
181 |
+
- Report to GitHub issue if you believe it's a bug.
|
182 |
""")
|
183 |
with gr.Row():
|
184 |
with gr.Column(scale=1):
|
|
|
258 |
strong_model,
|
259 |
],
|
260 |
outputs=[strong_base, strong_key, strong_model],
|
261 |
+
).then(
|
262 |
+
fn=lambda: gr.Accordion("AI setup (OpenAI-compatible LLM API)", open=True), inputs=None, outputs=[setup_zone]
|
263 |
)
|
264 |
|
265 |
infer_btn.click(
|
config.py
CHANGED
@@ -9,7 +9,7 @@ CHEAP_MODEL = os.getenv("CHEAP_MODEL") or "gpt-3.5-turbo"
|
|
9 |
|
10 |
STRONG_API_BASE = os.getenv("STRONG_API_BASE") or OPENAI_API_BASE
|
11 |
STRONG_API_KEY = os.getenv("STRONG_API_KEY") or OPENAI_API_KEY
|
12 |
-
STRONG_MODEL = os.getenv("STRONG_MODEL") or "gpt-4"
|
13 |
|
14 |
IS_SHARE = bool(os.getenv("IS_SHARE")) or False
|
15 |
IS_DEBUG = bool(os.getenv("IS_DEBUG")) or False
|
|
|
9 |
|
10 |
STRONG_API_BASE = os.getenv("STRONG_API_BASE") or OPENAI_API_BASE
|
11 |
STRONG_API_KEY = os.getenv("STRONG_API_KEY") or OPENAI_API_KEY
|
12 |
+
STRONG_MODEL = os.getenv("STRONG_MODEL") or "gpt-4-0125-preview"
|
13 |
|
14 |
IS_SHARE = bool(os.getenv("IS_SHARE")) or False
|
15 |
IS_DEBUG = bool(os.getenv("IS_DEBUG")) or False
|