jensinjames commited on
Commit
39328ee
·
1 Parent(s): 3e7f4b1

Add 4 files

Browse files
Files changed (4) hide show
  1. README.md +13 -7
  2. app.py +38 -0
  3. requirements.txt +3 -0
  4. setup.py +16 -0
README.md CHANGED
@@ -1,11 +1,17 @@
1
  ---
 
2
  title: Storyline Generator
3
- emoji: 🐨
4
- colorFrom: gray
5
- colorTo: indigo
6
- sdk: static
7
- pinned: false
8
- license: mit
9
  ---
 
10
 
11
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
1
  ---
2
+ license: apache-2.0
3
  title: Storyline Generator
4
+ sdk: gradio
5
+ sdk_version: 3.39.0
6
+ app_file: app.py
7
+ emoji: 👀
8
+ colorFrom: green
9
+ colorTo: blue
10
  ---
11
+ # Storyline Generator
12
 
13
+ Welcome to the Storyline Generator! This application uses Gradio to create an interactive interface for generating storylines for online advertising campaigns.
14
+
15
+ ## Usage
16
+
17
+ To use the application, simply launch a new Gradio UI by running the following command in your terminal:
app.py ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import numpy as np
3
+ import matplotlib.pyplot as plt
4
+
5
+ def generate_storyboard(impressions, purchases, returns, loyalty_level):
6
+ # Generate the data for the storyboard
7
+ data = {"Impressions": impressions, "Purchases": purchases, "Returns": returns}
8
+ data["Loyalty Level"] = loyalty_level
9
+
10
+ # Create the figure
11
+ fig, ax = plt.subplots(figsize=(8, 6))
12
+ ax.set_xlabel("Impressions")
13
+ ax.set_ylabel("Purchases")
14
+ ax.set_zlabel("Returns")
15
+ ax.grid(True)
16
+
17
+ # Plot the data
18
+ s = gr.element_types.plot(data, c="c", cmap="YlGnBu_r")
19
+ fig.colorbar(s, ax=ax)
20
+
21
+ # Add the legend
22
+ ax.legend(loc="lower left", fontsize=12)
23
+
24
+ return fig
25
+
26
+ # Define the base model
27
+ model = gr.Environment(input_types=[{"type": "impressions", "default": 100},
28
+ {"type": "purchases_made", "default": 10},
29
+ {"type": "returns", "default": 2},
30
+ {"type": "loyalty_level", "default": "Loyal"}],
31
+ output_type=generate_storyboard)
32
+
33
+ if __name__ == "__main__":
34
+ app = gr.App(function=model.apply,
35
+ inputs="side images",
36
+ outputs="image",
37
+ examples=[{"impressions": 200, "purchases_made": 15, "returns": 3, "loyalty_level": "Loyal"}])
38
+ app.launch()
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ numpy==1.20.1
2
+ matplotlib==3.4.2
3
+ gradio==3.39.0
setup.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from setuptools import setup
2
+
3
+ setup(
4
+ name="storyline-generator",
5
+ version="1.0",
6
+ description="A Gradio-powered storyline generator for online advertising",
7
+ long_description=open("README.md", "r").read(),
8
+ long_description_content_type="text/markdown",
9
+ url="https://github.com/author/storyline-generator",
10
+ author="Your Name",
11
+ author_email="your.email@example.com",
12
+ license="Apache License, Version 2.0",
13
+ packages=find_packages(),
14
+ install_requires=["numpy==1.20.1", "matplotlib==3.4.2", "gradio==3.39.0"],
15
+ zip_safe=False
16
+ )