Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
Β·
d32cb1d
1
Parent(s):
79a071f
Handled reddit env info. Added back buttons.
Browse files- content_distillery/static/content_distillery.html +11 -2
- main.py +3 -3
- templates/cbow.html +27 -4
content_distillery/static/content_distillery.html
CHANGED
@@ -7,6 +7,15 @@
|
|
7 |
<script src="https://cdn.tailwindcss.com"></script>
|
8 |
</head>
|
9 |
<body class="bg-gray-100 min-h-screen p-6 flex flex-col items-center">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
<div class="max-w-2xl w-full space-y-4">
|
12 |
<h1 class="text-3xl font-bold text-gray-800 text-center">π Content Distillery</h1>
|
@@ -95,7 +104,7 @@
|
|
95 |
const post = document.getElementById('inputText').value;
|
96 |
|
97 |
btn.disabled = true;
|
98 |
-
btn.textContent = "Generating...";
|
99 |
btn.classList.add("opacity-50");
|
100 |
|
101 |
try {
|
@@ -111,7 +120,7 @@
|
|
111 |
}
|
112 |
|
113 |
btn.disabled = false;
|
114 |
-
btn.textContent = "Generate Summary";
|
115 |
btn.classList.remove("opacity-50");
|
116 |
});
|
117 |
</script>
|
|
|
7 |
<script src="https://cdn.tailwindcss.com"></script>
|
8 |
</head>
|
9 |
<body class="bg-gray-100 min-h-screen p-6 flex flex-col items-center">
|
10 |
+
|
11 |
+
<a href="/" class="absolute top-4 left-4 text-blue-600 hover:text-blue-800 text-sm font-semibold flex items-center">
|
12 |
+
<!-- back arrow -->
|
13 |
+
<svg class="w-5 h-5 mr-1" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"
|
14 |
+
xmlns="http://www.w3.org/2000/svg">
|
15 |
+
<path stroke-linecap="round" stroke-linejoin="round" d="M15 19l-7-7 7-7"></path>
|
16 |
+
</svg>
|
17 |
+
Back to Home
|
18 |
+
</a>
|
19 |
|
20 |
<div class="max-w-2xl w-full space-y-4">
|
21 |
<h1 class="text-3xl font-bold text-gray-800 text-center">π Content Distillery</h1>
|
|
|
104 |
const post = document.getElementById('inputText').value;
|
105 |
|
106 |
btn.disabled = true;
|
107 |
+
btn.textContent = "π€ Generating...";
|
108 |
btn.classList.add("opacity-50");
|
109 |
|
110 |
try {
|
|
|
120 |
}
|
121 |
|
122 |
btn.disabled = false;
|
123 |
+
btn.textContent = "π€ Generate Summary";
|
124 |
btn.classList.remove("opacity-50");
|
125 |
});
|
126 |
</script>
|
main.py
CHANGED
@@ -20,9 +20,9 @@ from vit_captioning.generate import CaptionGenerator
|
|
20 |
from cbow_logic import MeaningCalculator
|
21 |
|
22 |
reddit = praw.Reddit(
|
23 |
-
client_id="
|
24 |
-
client_secret="
|
25 |
-
user_agent="ContentDistilleryBot
|
26 |
)
|
27 |
|
28 |
app = FastAPI()
|
|
|
20 |
from cbow_logic import MeaningCalculator
|
21 |
|
22 |
reddit = praw.Reddit(
|
23 |
+
client_id=os.getenv("REDDIT_CLIENT_ID"),
|
24 |
+
client_secret=os.getenv("REDDIT_CLIENT_SECRET"),
|
25 |
+
user_agent="script:ContentDistilleryBot:v0.1 (by u/ClementHa)"
|
26 |
)
|
27 |
|
28 |
app = FastAPI()
|
templates/cbow.html
CHANGED
@@ -116,6 +116,15 @@
|
|
116 |
</style>
|
117 |
</head>
|
118 |
<body>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
<h2>CBOW Vector Calculator</h2>
|
120 |
<form method="post" action="/cbow">
|
121 |
<label for="expression">Enter a word vector expression <small>(e.g. <code>king - man + woman</code>)</small>:</label><br>
|
@@ -165,10 +174,24 @@
|
|
165 |
<div class="modal-content">
|
166 |
<span class="close" onclick="closeModal('suggestionsModal')">×</span>
|
167 |
<h3>Suggestions</h3>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
<ul>
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
</ul>
|
173 |
</div>
|
174 |
</div>
|
@@ -177,7 +200,7 @@
|
|
177 |
<div class="modal-content">
|
178 |
<span class="close" onclick="closeModal('aboutModal')">×</span>
|
179 |
<h3>About</h3>
|
180 |
-
<p>This tool calculates vector arithmetic of words using a pretrained CBOW model
|
181 |
</div>
|
182 |
</div>
|
183 |
|
|
|
116 |
</style>
|
117 |
</head>
|
118 |
<body>
|
119 |
+
<a href="/" class="absolute top-4 left-4 text-blue-600 hover:text-blue-800 text-sm font-semibold flex items-center">
|
120 |
+
<!-- back arrow -->
|
121 |
+
<svg class="w-5 h-5 mr-1" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"
|
122 |
+
xmlns="http://www.w3.org/2000/svg">
|
123 |
+
<path stroke-linecap="round" stroke-linejoin="round" d="M15 19l-7-7 7-7"></path>
|
124 |
+
</svg>
|
125 |
+
Back to Home
|
126 |
+
</a>
|
127 |
+
|
128 |
<h2>CBOW Vector Calculator</h2>
|
129 |
<form method="post" action="/cbow">
|
130 |
<label for="expression">Enter a word vector expression <small>(e.g. <code>king - man + woman</code>)</small>:</label><br>
|
|
|
174 |
<div class="modal-content">
|
175 |
<span class="close" onclick="closeModal('suggestionsModal')">×</span>
|
176 |
<h3>Suggestions</h3>
|
177 |
+
<p>What's your guess, before calculating it?</p>
|
178 |
+
<ul>
|
179 |
+
<li><code>mother - woman + man</code></li>
|
180 |
+
<li><code>iphone - phone + tablet</code></li>
|
181 |
+
<li><code>hotdog - sausage + beef</code></li>
|
182 |
+
<li><code>brisbane - city + capital</code></li>
|
183 |
+
<li><code>uk - monarchy</code></li>
|
184 |
+
<li><code>kfc - chicken + pork</code></li>
|
185 |
+
<li><code>skoda - czech + germany</code></li>
|
186 |
+
<li><code>starwars - darthvader + sauron</code></li>
|
187 |
+
<li><code>callofduty - gun + knife</code></li>
|
188 |
+
</ul>
|
189 |
+
|
190 |
+
<p><strong>Tips:</strong></p>
|
191 |
<ul>
|
192 |
+
<li>Use <code>-</code> and <code>+</code> operators, with a space before and after each operator.</li>
|
193 |
+
<li>Link compound words with a hyphen, e.g., <code>new-york</code>.</li>
|
194 |
+
<li>Got a fun suggestion? Email: <a href="mailto:[email protected]">[email protected]</a></li>
|
195 |
</ul>
|
196 |
</div>
|
197 |
</div>
|
|
|
200 |
<div class="modal-content">
|
201 |
<span class="close" onclick="closeModal('aboutModal')">×</span>
|
202 |
<h3>About</h3>
|
203 |
+
<p>This tool calculates vector arithmetic of words using a pretrained CBOW model glove-twitter-200.</p>
|
204 |
</div>
|
205 |
</div>
|
206 |
|