Jan Kirenz
commited on
Commit
•
04a5a41
1
Parent(s):
ad6f073
added uv
Browse files
README.md
CHANGED
@@ -12,3 +12,62 @@ short_description: Interactive Marketing Text Generator
|
|
12 |
---
|
13 |
|
14 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
---
|
13 |
|
14 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
15 |
+
|
16 |
+
## Configuration
|
17 |
+
|
18 |
+
The project is configured to use `uv` with the following `uv.yml` file:
|
19 |
+
|
20 |
+
```yaml
|
21 |
+
name: marketing-text-generator
|
22 |
+
dependencies:
|
23 |
+
- python=3.10
|
24 |
+
- pip:
|
25 |
+
- streamlit
|
26 |
+
- transformers
|
27 |
+
scripts:
|
28 |
+
start: streamlit run app.py
|
29 |
+
```
|
30 |
+
|
31 |
+
## Setup and Usage with `uv`
|
32 |
+
|
33 |
+
To manage this project with `uv`, follow these steps:
|
34 |
+
|
35 |
+
### Prerequisites
|
36 |
+
|
37 |
+
Ensure you have `uv` installed. If not, you can install it using pip:
|
38 |
+
|
39 |
+
```sh
|
40 |
+
pip install uv
|
41 |
+
```
|
42 |
+
|
43 |
+
### Initializing the `uv` Environment
|
44 |
+
|
45 |
+
1. **Initialize the `uv` environment**: Run the following command to set up the environment based on the `uv.yml` configuration:
|
46 |
+
|
47 |
+
```sh
|
48 |
+
uv start
|
49 |
+
```
|
50 |
+
|
51 |
+
2. **Activate the `uv` environment**: Use the following command to activate the environment:
|
52 |
+
|
53 |
+
```sh
|
54 |
+
uv activate
|
55 |
+
```
|
56 |
+
|
57 |
+
### Running the Streamlit App
|
58 |
+
|
59 |
+
Once the environment is set up and activated, you can start the Streamlit app using the defined script:
|
60 |
+
|
61 |
+
```sh
|
62 |
+
uv run start
|
63 |
+
```
|
64 |
+
|
65 |
+
This command will launch the Streamlit app, and you can access it in your web browser.
|
66 |
+
|
67 |
+
### Notes
|
68 |
+
|
69 |
+
- The first time you run the app, it may take a while to load as it downloads and sets up the necessary dependencies.
|
70 |
+
- Ensure all required fields in the form are filled out before generating the marketing text.
|
71 |
+
- Review and edit the generated texts as needed before using them.
|
72 |
+
|
73 |
+
For more information on `uv`, refer to the [official documentation](https://github.com/iterative/uv).
|
app.py
CHANGED
@@ -9,7 +9,8 @@ def load_gpt2():
|
|
9 |
try:
|
10 |
# Wir verwenden das deutsche GPT-2 Modell für bessere deutsche Texte
|
11 |
return pipeline('text-generation',
|
12 |
-
model='
|
|
|
13 |
device=-1)
|
14 |
except Exception as e:
|
15 |
st.error(f"Modell konnte nicht geladen werden: {str(e)}")
|
|
|
9 |
try:
|
10 |
# Wir verwenden das deutsche GPT-2 Modell für bessere deutsche Texte
|
11 |
return pipeline('text-generation',
|
12 |
+
model='dbmdz/german-gpt2',
|
13 |
+
tokenizer="dbmdz/german-gpt2",
|
14 |
device=-1)
|
15 |
except Exception as e:
|
16 |
st.error(f"Modell konnte nicht geladen werden: {str(e)}")
|
uv.yml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: marketing-text-generator
|
2 |
+
dependencies:
|
3 |
+
- python=3.11
|
4 |
+
- pip:
|
5 |
+
- streamlit
|
6 |
+
- transformers
|
7 |
+
scripts:
|
8 |
+
start: streamlit run app.py
|