-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
83 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
summarizer: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.12.7' | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.22.1' | ||
|
||
# Step 3: Run setup.sh to install necessary dependencies | ||
- name: Run setup.sh | ||
run: | | ||
chmod +x setup.sh | ||
./setup.sh | ||
- name: Run summarizer script | ||
run: | | ||
go run .\main.go | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,34 @@ | ||
package boo_bee | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os/exec" | ||
) | ||
|
||
func main() { | ||
article := `Once, in a town surrounded by endless fields of sunflowers, there was a clockmaker named Felix. He was known not only for his skill but also for the magic he seemed to weave into every clock he made. His creations were always precise, but more than that, they had a curious tendency to affect time itself. | ||
One day, a mysterious woman named Selene entered his shop, carrying a peculiar timepiece. It was an ancient pocket watch, its gold exterior dull and worn. "This watch," she said, her voice low and calm, "does not count time as it should. Can you fix it?" | ||
Felix examined the watch, noticing something odd. Its hands moved backward slowly, as if trying to undo the past. He carefully opened the back, revealing intricate mechanisms that seemed almost alive, ticking and shifting on their own. | ||
"I can try," Felix replied, intrigued. Over the next few days, he worked tirelessly on the watch, but every time he adjusted a gear or tightened a spring, the watch would reverse even faster. It seemed to resist any attempt to move forward. | ||
Late one night, as Felix was on the verge of giving up, the watch suddenly stopped. For a moment, everything around him grew silent. The world outside his window froze—no wind, no rustling leaves, not even a sound from the busy street. Felix realized the watch wasn’t broken; it had been controlling time all along. | ||
Selene returned the next morning. "It’s not meant to be fixed," Felix told her. "This watch... it controls time. I can feel it." | ||
Selene smiled knowingly. "I didn’t ask you to fix it, Felix. I asked you to understand it." | ||
In that moment, Felix felt the weight of the years lift off his shoulders. The clocks around him chimed all at once, marking a new beginning. Selene took the watch, leaving behind a single sunflower on his workbench, and with a nod, she disappeared as quietly as she had arrived. | ||
From that day forward, Felix’s clocks never just told time—they gave people a chance to find moments they thought they had lost, offering glimpses into the past and a way to reshape their futures.` | ||
cmd := exec.Command("python3", "summarize.py", article) | ||
|
||
out, err := cmd.CombinedOutput() | ||
if err != nil { | ||
fmt.Println("Error:", err) | ||
} | ||
|
||
fmt.Println("Summary:", string(out)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pip install --upgrade pip | ||
pip install transformers | ||
pip install torch torchvision torchaudio | ||
pip install tensorflow | ||
pip install tf-keras |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from transformers import pipeline | ||
|
||
def summarize(article): | ||
summarizer = pipeline("summarization", model="facebook/bart-large-cnn") | ||
summary = summarizer(article, min_length=300, do_sample=False) | ||
return summary[0]['summary_text'] | ||
|
||
if __name__ == "__main__": | ||
import sys | ||
article = sys.argv[1] | ||
print(summarize(article)) |