M96820 commited on
Commit
af73633
·
unverified ·
1 Parent(s): 24bdd7c

setup: edit readme and change llm to mistral

Browse files
ai-comic-factory/.env.example CHANGED
@@ -1,17 +1,5 @@
1
- # Supported values:
2
- # - VIDEOCHAIN
3
- # - REPLICATE
4
- # - INFERENCE_ENDPOINT
5
- # - INFERENCE_API
6
- # - OPENAI
7
  RENDERING_ENGINE="INFERENCE_ENDPOINT"
8
 
9
- # Supported values:
10
- # - INFERENCE_ENDPOINT
11
- # - INFERENCE_API
12
- # - OPENAI
13
- # - GROQ
14
- # - ANTHROPIC
15
  LLM_ENGINE="INFERENCE_API"
16
 
17
  # set this to control the number of pages
@@ -20,95 +8,22 @@ MAX_NB_PAGES=6
20
  # Set to "true" to create artificial delays and smooth out traffic
21
  NEXT_PUBLIC_ENABLE_RATE_LIMITER="false"
22
 
23
- # ------------- HUGGING FACE OAUTH -------------
24
- ENABLE_HUGGING_FACE_OAUTH=
25
- ENABLE_HUGGING_FACE_OAUTH_WALL=
26
- HUGGING_FACE_OAUTH_CLIENT_ID=
27
-
28
- # in production this should be the space's domain and/or URL
29
- HUGGING_FACE_OAUTH_REDIRECT_URL=
30
-
31
- # this one must be kept secret (and is unused for now)
32
- HUGGING_FACE_OAUTH_SECRET=
33
-
34
  # ------------- PROVIDER AUTH ------------
35
- # You only need to configure the access token(s) for the provider(s) you want to use
36
-
37
- # HuggingFace.co token: available for the LLM engine and the RENDERING engine
38
- AUTH_HF_API_TOKEN=
39
-
40
- # Replicate.com token: available for the RENDERING engine
41
- AUTH_REPLICATE_API_TOKEN=
42
-
43
- # OpenAI.dom token: available for the LLM engine and the RENDERING engine
44
- AUTH_OPENAI_API_KEY=
45
-
46
- # An experimental RENDERING engine (sorry it is not very documented yet, so you can use one of the other engines)
47
- AUTH_VIDEOCHAIN_API_TOKEN=
48
-
49
- # Groq.com key: available for the LLM engine
50
- AUTH_GROQ_API_KEY=
51
-
52
- # Anthropic.com key: available for the LLM engine
53
- AUTH_ANTHROPIC_API_KEY=
54
 
55
  # ------------- RENDERING API CONFIG --------------
56
 
57
- # If you decide to use Replicate for the RENDERING engine
58
- RENDERING_REPLICATE_API_MODEL="stabilityai/sdxl"
59
- RENDERING_REPLICATE_API_MODEL_VERSION="da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf"
60
-
61
  # If you decide to use a private Hugging Face Inference Endpoint for the RENDERING engine
62
  RENDERING_HF_INFERENCE_ENDPOINT_URL="https://XXXXXXXXXX.endpoints.huggingface.cloud"
63
 
64
- # If you decide to use a Hugging Face Inference API model for the RENDERING engine
65
- RENDERING_HF_INFERENCE_API_BASE_MODEL="stabilityai/stable-diffusion-xl-base-1.0"
66
-
67
- # If you decide to use a Hugging Face Inference API model for the RENDERING engine
68
- RENDERING_HF_INFERENCE_API_REFINER_MODEL="stabilityai/stable-diffusion-xl-refiner-1.0"
69
-
70
- # If your model returns a different file type (eg. jpg or webp) change it here
71
- RENDERING_HF_INFERENCE_API_FILE_TYPE="image/png"
72
-
73
- # An experimental RENDERING engine (sorry it is not very documented yet, so you can use one of the other engines)
74
- RENDERING_VIDEOCHAIN_API_URL="http://localhost:7860"
75
-
76
- RENDERING_OPENAI_API_BASE_URL="https://api.openai.com/v1"
77
- RENDERING_OPENAI_API_MODEL="dall-e-3"
78
-
79
  # ------------- LLM API CONFIG ----------------
80
 
81
- LLM_GROQ_API_MODEL="mixtral-8x7b-32768"
82
-
83
- # If you decide to use OpenAI for the LLM engine
84
- LLM_OPENAI_API_BASE_URL="https://api.openai.com/v1"
85
- LLM_OPENAI_API_MODEL="gpt-4-turbo"
86
-
87
- # If you decide to use Anthropic (eg. Claude) for the LLM engine
88
- # https://docs.anthropic.com/claude/docs/models-overview
89
- LLM_ANTHROPIC_API_MODEL="claude-3-opus-20240229"
90
-
91
- # If you decide to use a private Hugging Face Inference Endpoint for the LLM engine
92
- LLM_HF_INFERENCE_ENDPOINT_URL=""
93
-
94
  # If you decide to use a Hugging Face Inference API model for the LLM engine
95
  # LLM_HF_INFERENCE_API_MODEL="HuggingFaceH4/zephyr-7b-beta"
96
- LLM_HF_INFERENCE_API_MODEL="HuggingFaceH4/zephyr-7b-beta"
97
 
98
- # ----------- COMMUNITY SHARING (OPTIONAL) -----------
99
- # You don't need those community sharing options to run the AI Comic Factory
100
- # locally or on your own server (they are meant to be used by the Hugging Face team)
101
- NEXT_PUBLIC_ENABLE_COMMUNITY_SHARING="false"
102
- COMMUNITY_API_URL=
103
- COMMUNITY_API_TOKEN=
104
- COMMUNITY_API_ID=
105
 
106
  # ----------- CENSORSHIP (OPTIONAL) -----------
107
  # censorship is currently disabled, but will be required when we create a "community roll"
108
  # (a public repositoruy of user-generated comic strips)
109
- ENABLE_CENSORSHIP="false"
110
-
111
- # Due to the sensitive nature of some of keywords we want to ban (users try all kind of crazy illegal things)
112
- # the words are are not put in clear in the source code, but behind an encryption key
113
- # (I don't want the project to be flagged by an AI robot police on GitHub or something)
114
- SECRET_FINGERPRINT=""
 
 
 
 
 
 
 
1
  RENDERING_ENGINE="INFERENCE_ENDPOINT"
2
 
 
 
 
 
 
 
3
  LLM_ENGINE="INFERENCE_API"
4
 
5
  # set this to control the number of pages
 
8
  # Set to "true" to create artificial delays and smooth out traffic
9
  NEXT_PUBLIC_ENABLE_RATE_LIMITER="false"
10
 
 
 
 
 
 
 
 
 
 
 
 
11
  # ------------- PROVIDER AUTH ------------
12
+ AUTH_HF_API_TOKEN="YOUR_HF_API_TOKEN"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
  # ------------- RENDERING API CONFIG --------------
15
 
 
 
 
 
16
  # If you decide to use a private Hugging Face Inference Endpoint for the RENDERING engine
17
  RENDERING_HF_INFERENCE_ENDPOINT_URL="https://XXXXXXXXXX.endpoints.huggingface.cloud"
18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  # ------------- LLM API CONFIG ----------------
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  # If you decide to use a Hugging Face Inference API model for the LLM engine
22
  # LLM_HF_INFERENCE_API_MODEL="HuggingFaceH4/zephyr-7b-beta"
23
+ LLM_HF_INFERENCE_API_MODEL="mistralai/Mistral-7B-Instruct-v0.3"
24
 
 
 
 
 
 
 
 
25
 
26
  # ----------- CENSORSHIP (OPTIONAL) -----------
27
  # censorship is currently disabled, but will be required when we create a "community roll"
28
  # (a public repositoruy of user-generated comic strips)
29
+ ENABLE_CENSORSHIP="false"
 
 
 
 
 
ai-comic-factory/README.md CHANGED
@@ -24,178 +24,8 @@ npm run dev
24
  ```
25
  # AI Comic Factory
26
 
27
- Last release: AI Comic Factory 1.2
28
 
29
- The AI Comic Factory will soon have an official website: [aicomicfactory.app](https://aicomicfactory.app)
30
 
31
- For more information about my other projects please check [linktr.ee/FLNGR](https://linktr.ee/FLNGR).
32
-
33
- ## Running the project at home
34
-
35
- First, I would like to highlight that everything is open-source (see [here](https://huggingface.co/spaces/jbilcke-hf/ai-comic-factory/tree/main), [here](https://huggingface.co/spaces/jbilcke-hf/VideoChain-API/tree/main), [here](https://huggingface.co/spaces/hysts/SD-XL/tree/main), [here](https://github.com/huggingface/text-generation-inference)).
36
-
37
- However the project isn't a monolithic Space that can be duplicated and ran immediately:
38
- it requires various components to run for the frontend, backend, LLM, SDXL etc.
39
-
40
- If you try to duplicate the project, open the `.env` you will see it requires some variables.
41
-
42
- Provider config:
43
- - `LLM_ENGINE`: can be one of `INFERENCE_API`, `INFERENCE_ENDPOINT`, `OPENAI`, `GROQ`, `ANTHROPIC`
44
- - `RENDERING_ENGINE`: can be one of: "INFERENCE_API", "INFERENCE_ENDPOINT", "REPLICATE", "VIDEOCHAIN", "OPENAI" for now, unless you code your custom solution
45
-
46
- Auth config:
47
- - `AUTH_HF_API_TOKEN`: if you decide to use Hugging Face for the LLM engine (inference api model or a custom inference endpoint)
48
- - `AUTH_OPENAI_API_KEY`: to use OpenAI for the LLM engine
49
- - `AUTH_GROQ_API_KEY`: to use Groq for the LLM engine
50
- - `AUTH_ANTHROPIC_API_KEY`: to use Anthropic (Claude) for the LLM engine
51
- - `AUTH_VIDEOCHAIN_API_TOKEN`: secret token to access the VideoChain API server
52
- - `AUTH_REPLICATE_API_TOKEN`: in case you want to use Replicate.com
53
-
54
- Rendering config:
55
- - `RENDERING_HF_INFERENCE_ENDPOINT_URL`: necessary if you decide to use a custom inference endpoint
56
- - `RENDERING_REPLICATE_API_MODEL_VERSION`: url to the VideoChain API server
57
- - `RENDERING_HF_INFERENCE_ENDPOINT_URL`: optional, default to nothing
58
- - `RENDERING_HF_INFERENCE_API_BASE_MODEL`: optional, defaults to "stabilityai/stable-diffusion-xl-base-1.0"
59
- - `RENDERING_HF_INFERENCE_API_REFINER_MODEL`: optional, defaults to "stabilityai/stable-diffusion-xl-refiner-1.0"
60
- - `RENDERING_REPLICATE_API_MODEL`: optional, defaults to "stabilityai/sdxl"
61
- - `RENDERING_REPLICATE_API_MODEL_VERSION`: optional, in case you want to change the version
62
-
63
- Language model config (depending on the LLM engine you decide to use):
64
- - `LLM_HF_INFERENCE_ENDPOINT_URL`: "<use your own>"
65
- - `LLM_HF_INFERENCE_API_MODEL`: "HuggingFaceH4/zephyr-7b-beta"
66
- - `LLM_OPENAI_API_BASE_URL`: "https://api.openai.com/v1"
67
- - `LLM_OPENAI_API_MODEL`: "gpt-4-turbo"
68
- - `LLM_GROQ_API_MODEL`: "mixtral-8x7b-32768"
69
- - `LLM_ANTHROPIC_API_MODEL`: "claude-3-opus-20240229"
70
-
71
- In addition, there are some community sharing variables that you can just ignore.
72
- Those variables are not required to run the AI Comic Factory on your own website or computer
73
- (they are meant to create a connection with the Hugging Face community,
74
- and thus only make sense for official Hugging Face apps):
75
- - `NEXT_PUBLIC_ENABLE_COMMUNITY_SHARING`: you don't need this
76
- - `COMMUNITY_API_URL`: you don't need this
77
- - `COMMUNITY_API_TOKEN`: you don't need this
78
- - `COMMUNITY_API_ID`: you don't need this
79
-
80
- Please read the `.env` default config file for more informations.
81
- To customise a variable locally, you should create a `.env.local`
82
- (do not commit this file as it will contain your secrets).
83
-
84
- -> If you intend to run it with local, cloud-hosted and/or proprietary models **you are going to need to code 👨‍💻**.
85
-
86
- ## The LLM API (Large Language Model)
87
-
88
- Currently the AI Comic Factory uses [zephyr-7b-beta](https://huggingface.co/HuggingFaceH4/zephyr-7b-beta) through an [Inference Endpoint](https://huggingface.co/docs/inference-endpoints/index).
89
-
90
- You have multiple options:
91
-
92
- ### Option 1: Use an Inference API model
93
-
94
- This is a new option added recently, where you can use one of the models from the Hugging Face Hub. By default we suggest to use [zephyr-7b-beta](https://huggingface.co/HuggingFaceH4/zephyr-7b-beta) as it will provide better results than the 7b model.
95
-
96
- To activate it, create a `.env.local` configuration file:
97
-
98
- ```bash
99
- LLM_ENGINE="INFERENCE_API"
100
-
101
- HF_API_TOKEN="Your Hugging Face token"
102
-
103
- # "HuggingFaceH4/zephyr-7b-beta" is used by default, but you can change this
104
- # note: You should use a model able to generate JSON responses,
105
- # so it is storngly suggested to use at least the 34b model
106
- HF_INFERENCE_API_MODEL="HuggingFaceH4/zephyr-7b-beta"
107
- ```
108
-
109
- ### Option 2: Use an Inference Endpoint URL
110
-
111
- If you would like to run the AI Comic Factory on a private LLM running on the Hugging Face Inference Endpoint service, create a `.env.local` configuration file:
112
-
113
- ```bash
114
- LLM_ENGINE="INFERENCE_ENDPOINT"
115
-
116
- HF_API_TOKEN="Your Hugging Face token"
117
-
118
- HF_INFERENCE_ENDPOINT_URL="path to your inference endpoint url"
119
- ```
120
-
121
- To run this kind of LLM locally, you can use [TGI](https://github.com/huggingface/text-generation-inference) (Please read [this post](https://github.com/huggingface/text-generation-inference/issues/726) for more information about the licensing).
122
-
123
- ### Option 3: Use an OpenAI API Key
124
-
125
- This is a new option added recently, where you can use OpenAI API with an OpenAI API Key.
126
-
127
- To activate it, create a `.env.local` configuration file:
128
-
129
- ```bash
130
- LLM_ENGINE="OPENAI"
131
-
132
- # default openai api base url is: https://api.openai.com/v1
133
- LLM_OPENAI_API_BASE_URL="A custom OpenAI API Base URL if you have some special privileges"
134
-
135
- LLM_OPENAI_API_MODEL="gpt-4-turbo"
136
-
137
- AUTH_OPENAI_API_KEY="Yourown OpenAI API Key"
138
- ```
139
- ### Option 4: (new, experimental) use Groq
140
-
141
- ```bash
142
- LLM_ENGINE="GROQ"
143
-
144
- LLM_GROQ_API_MODEL="mixtral-8x7b-32768"
145
-
146
- AUTH_GROQ_API_KEY="Your own GROQ API Key"
147
- ```
148
- ### Option 5: (new, experimental) use Anthropic (Claude)
149
-
150
- ```bash
151
- LLM_ENGINE="ANTHROPIC"
152
-
153
- LLM_ANTHROPIC_API_MODEL="claude-3-opus-20240229"
154
-
155
- AUTH_ANTHROPIC_API_KEY="Your own ANTHROPIC API Key"
156
- ```
157
-
158
- ### Option 6: Fork and modify the code to use a different LLM system
159
-
160
- Another option could be to disable the LLM completely and replace it with another LLM protocol and/or provider (eg. Claude, Replicate), or a human-generated story instead (by returning mock or static data).
161
-
162
- ### Notes
163
-
164
- It is possible that I modify the AI Comic Factory to make it easier in the future (eg. add support for Claude or Replicate)
165
-
166
- ## The Rendering API
167
-
168
- This API is used to generate the panel images. This is an API I created for my various projects at Hugging Face.
169
-
170
- I haven't written documentation for it yet, but basically it is "just a wrapper ™" around other existing APIs:
171
-
172
- - The [hysts/SD-XL](https://huggingface.co/spaces/hysts/SD-XL?duplicate=true) Space by [@hysts](https://huggingface.co/hysts)
173
- - And other APIs for making videos, adding audio etc.. but you won't need them for the AI Comic Factory
174
-
175
- ### Option 1: Deploy VideoChain yourself
176
-
177
- You will have to [clone](https://huggingface.co/spaces/jbilcke-hf/VideoChain-API?duplicate=true) the [source-code](https://huggingface.co/spaces/jbilcke-hf/VideoChain-API/tree/main)
178
-
179
- Unfortunately, I haven't had the time to write the documentation for VideoChain yet.
180
- (When I do I will update this document to point to the VideoChain's README)
181
-
182
-
183
- ### Option 2: Use Replicate
184
-
185
- To use Replicate, create a `.env.local` configuration file:
186
-
187
- ```bash
188
- RENDERING_ENGINE="REPLICATE"
189
-
190
- RENDERING_REPLICATE_API_MODEL="stabilityai/sdxl"
191
-
192
- RENDERING_REPLICATE_API_MODEL_VERSION="da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf"
193
-
194
- AUTH_REPLICATE_API_TOKEN="Your Replicate token"
195
- ```
196
-
197
- ### Option 3: Use another SDXL API
198
-
199
- If you fork the project you will be able to modify the code to use the Stable Diffusion technology of your choice (local, open-source, proprietary, your custom HF Space etc).
200
-
201
- It would even be something else, such as Dall-E.
 
24
  ```
25
  # AI Comic Factory
26
 
27
+ This project is a fork from Julian Bilcke's AI Comic Factory v1.2
28
 
29
+ The AI Comic Factory now has an official website: [aicomicfactory.app](https://aicomicfactory.app)
30
 
31
+ For more information about Julian Bilcke's other projects please check [linktr.ee/FLNGR](https://linktr.ee/FLNGR).