Skip to content

Commit

Permalink
first functioning commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Parisa68 committed Oct 20, 2024
1 parent 5eeec73 commit 82ffacd
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 1 deletion.
33 changes: 33 additions & 0 deletions .github/workflows/run.yml
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
35 changes: 34 additions & 1 deletion main.go
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))
}
5 changes: 5 additions & 0 deletions setup.sh
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
11 changes: 11 additions & 0 deletions summarize.py
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))

0 comments on commit 82ffacd

Please sign in to comment.