Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[News API] Summarization returns empty string #150

Open
NikashS opened this issue Mar 1, 2023 · 2 comments
Open

[News API] Summarization returns empty string #150

NikashS opened this issue Mar 1, 2023 · 2 comments

Comments

@NikashS
Copy link

NikashS commented Mar 1, 2023

import requests
json_body = {
    "url": "https://static.remotasks.com/uploads/61095caaada54100bb515474/short.txt"
}
resp = requests.post("https://api.smrzr.io/v1/summarize/news?num_sentences=50", json=json_body).json()
print(resp)

returns {'summary': ''}

any thoughts? hoping to use the news endpoint because you mentioned there's a limit of 10,000 characters bc of lambda constraint, I wonder if passing in a URL instead would get around this constraint?

@nilukush
Copy link

nilukush commented Mar 3, 2024

I have a simple program

from summarizer import Summarizer


def generate_summary(transcript):
    try:
        model = Summarizer()
        summary = model(transcript)
        if summary:
            return ''.join(summary)
        else:
            return "Unable to generate a summary. The model didn't return any output."
    except Exception as e:
        # Catching and returning any exceptions encountered during summarization
        return f"An error occurred: {str(e)}"
from app.services.summary_service import generate_summary


def main():
    transcript = ("i've been suffering from gas bloating heartburn and other gut related symptoms for so many years "
                  "but now when i finally heal my gut i just want to share my experience and help anyone out there "
                  "who is dealing with gut problems because you can heal your gut too i want to share my story and "
                  "educate you guys on microbiome and why it's so important for a gut health plus i want to give you "
                  "some tips for healing your gut leaky gut ibs sibo i'll give you some ideas of what types of food "
                  "you can eat share my supplements routine lifestyle changes you can make so it's going to be very "
                  "very interesting video hi guys welcome back to my channel my name is anastasia and on this channel "
                  "we are talking about healthy lifestyle nutrition and mindset to optimize the quality of your life "
                  "before starting i just want to mention i'm not a doctor i'm not a medical professional i'm just a "
                  "human being sharing my life experience with you guys because i think i can help you oh gosh i've "
                  "been dealing with bloating sibo ibs castratus like the whole chamber for so many years is just "
                  "insane but now i'm good i'm fine i feel good my belly is flat and of course i do sometimes have "
                  "bloating and mostly because i'm in a rush i forget to soak my beans and stuff like that at some "
                  "point of my life i had such a painful bloating i just could not you know breathe i was so "
                  "miserable so i ended up in a hospital actually and i spent three days there the doctors tried to "
                  "find something and they actually did not their conclusion was i just had so much gas and it was "
                  "like the cause of my problems but it was actually the symptoms of my problems and i know that now "
                  "but unfortunately not all doctors are aware of the topic of microbiome so i've been checked on all "
                  "sorts of machines i did all sorts of tests and there was no solution to my problem one year later "
                  "i've been diagnosed with helicobacter pillary and sibo as well so they said i have to take some "
                  "antibiotics to heal my helicobacter first and then i have to make like another round for my sibo "
                  "at this point of my life i tried a low food my diet i tried sibo diet which is super crazy i tried "
                  "keto diet paleo diet by the way on keto i felt like super terrible and i noticed the worsening of "
                  "my symptoms and i didn't know why because it's supposed to be the other way around but now i do "
                  "know and it all comes to one thing which is dysbiosis and cutting out all the carbohydrates and "
                  "fiber-rich foods from your diet even the famous paleo diet has shown very negative impact on our "
                  "gut health because it excludes very important food groups like whole grains and legumes there is a "
                  "study by the researchers from edit cohen university confirming that i'll link this study below but "
                  "long story short basically this study compared the paleo diet with the australian guide to healthy "
                  "eating that advises people to eat from the five main food groups of vegetables fruits grains lean "
                  "meats and dairy while limiting saturated fat salt sugars and alcohol and the research said that "
                  "cutting out whole grains and legumes contributed to sleep problems tenderness diarrhea and mental "
                  "problems and there is no surprise there i personally noticed a huge improvement with my gut health "
                  "when i added whole grains back into my diet i didn't know the science based explanation but i do "
                  "know now and it all comes to dysbiosis and microbiome recently i've came across this book called "
                  "fiber filled and i'm so in love with this book guys and i just can't recommend it enough although "
                  "i don't think that there is like one size fits all kind of diet like for example plant-based diet "
                  "that is promoted in the book but i do believe in a plant-predominant diet and it all comes to a "
                  "microbiome there are five groups of organisms living in our body bacteria yeast parasites viruses "
                  "and archaea there are at least 39 million of those microorganisms living in our gut can you "
                  "imagine that i mean it's huge and the diversity of the species is very very important to our gut "
                  "health why those microbes are so important they play a huge role in our immune system brain "
                  "function weight loss metabolic function hormonal health so they are very very important to our "
                  "health and when we are messing up with our diet when we feed not the right microbes we are "
                  "damaging our entire health look at this list of health problems associated with these bios wow "
                  "like this is insane when we are having ibs symptoms and all that related issues it's like the "
                  "first sign of dysbiosis so when we have like a super healthy gut a very diverse microbiome we can "
                  "eat anything and just feel great when we damage our gut we are becoming less capable of digesting "
                  "certain foods because we are liking the microbes who can digest certain types of food and this is "
                  "why we have all those symptoms like blood and gas but it can be fixed and it's so amazing that you "
                  "can fix it just with your diet like changing your diet and lifestyle habits it's just so easy and "
                  "you can do it in order to heal our gut we need to feed the right bacteria with the right foods and "
                  "what food do we need to help our gut bacteria try fiber fiber is very very crucial to our gut "
                  "health it's simply because healthy bacteria can't survive without fiber we need to treat our bugs "
                  "with love the microbes need prebiotic are microbes which are probiotic they need actually "
                  "prebiotic so they can be satisfied and they can produce more good bacteria and they can do all the "
                  "good stuff they can actually do magic they produce postbiotics with biotics it's like the final "
                  "product of the probiotics and prebiotics when the bacteria is happy and satisfied they actually "
                  "can produce short chain fatty acids these short chain fatty acids are the most beneficial things "
                  "on earth for a gut health why they are so cool well this short chain fatty acids they change our "
                  "microbiomes so the bad pathogenic microbes die and they good bacteria good species they grow they "
                  "repair leaky gut they hail ibs they support the immune system and reverse inflammation i mean "
                  "what's not to love to make those short faint jetty essence bacteria should feed on fiber fiber is "
                  "feeding good microbes so they are multiplying besides fiber bacteria thrives on a resistant "
                  "starches like oats legumes rice sweet potato the key is to include the different types of fiber to "
                  "fit different types of microbes the diversity is very very important if you eat like the same food "
                  "every single day you are literally eating the same microbes and this is the reason why you can "
                  "experience like bloating after eating out when you eat something new it's just because your "
                  "microbiome does not have the bacteria to break down those foods it's so interesting that we've "
                  "been told to exclude all those beneficial foods fiber-rich foods from a diet while the research "
                  "said that people who is suffering from leaky gut ibs and sibo they're actually people who need "
                  "those foods the most when we starve for good bacteria our human body is actually starting to "
                  "replace those good bugs with the bed bug so we get the whole span of bloating gas diarrhea and "
                  "abdominal pain but the most interesting thing is if you can't digest certain types of food now you "
                  "can actually fix it and you will be able to do it in the future our gut is like a muscle and we "
                  "actually can train it so with time slowly but surely we can train a gut and we can actually digest "
                  "all types of food without any symptoms okay what else do we have just want to mention that i "
                  "actually did take some antibiotics for my age pillory infection and i supposed to take some drugs "
                  "for my sibo but i actually did not and i decided why not to try change my diet first because i "
                  "mean you always can take pills right start with your diet and lifestyle changes first and if it "
                  "doesn't help you can always proceed with a low fodmap protocol i think everyone understands the "
                  "diet like food map low food map diet or like sibo diet strict sibo diet they like short-term diets "
                  "that you can do then you have to reintroduce those foods and restore your microbiome remember "
                  "plant diversity is very very important we need to include all different plants to feed all "
                  "different microbes in raga sauerkraut kimchi yogurt miso tempeh sourdough bread kombucha all these "
                  "yummy delicious foods they are so beneficial for a gut health i'm actually planning to make a "
                  "video on how to make the best and the easiest sauerkraut so stay tuned for that think of quinoa "
                  "rice oats buckwheat rye whole wheat although some congrats have like a bad rep due to lectins "
                  "fatty acids and stuff like that there is a way to make these whole grains more digestible it's "
                  "soaking i actually do have a guide on how to soak your grains and legumes as well on my app green "
                  "app and i do have it on my blog as well i'll put the link in the description box below you can "
                  "check it out whole fruits greens and vegetables they are super super high in fiber think of leafy "
                  "greens carrots bell peppers broccoli cauliflower sweet potato onion garlic by the way onion and "
                  "garlic have antibacterial properties they are so great for overall health it's actually a staple "
                  "in the blue zones diet they are rich in fiber and in resistant starches in protein as well it's "
                  "like a superfood and i think legumes are so underrated these days sprout your plates with "
                  "chickpeas lentils and all sorts of beans think of flax seeds hemp seeds walnuts chia seeds nuts "
                  "are nutrition powerhouses they are rich in protein fiber antioxidants they're a great source of "
                  "several vitamins and minerals such as copper magnesium potassium folate and last but not least "
                  "mushrooms mushrooms are so so good for you they're not only very delicious and packed with umami "
                  "they're also high in vitamin d so they support the immune system mushrooms contain a prebiotic "
                  "beta-glucan so they feed on microbes as well that being said expand your menu i personally aim to "
                  "eat at least 40 different types of plants in a week but you can start slow and with time increase "
                  "the amount and diversity of plants in your diet it's very important to mention that you don't have "
                  "to go nuts it's actually counterproductive if you start you know eating all those fiber rich foods "
                  "like crazy no it's not going to help you it will probably make it worse if you have to go slow "
                  "next time you go to your farmers market or your local grocery store pick up a few of the "
                  "vegetables and other plant foods you normally skip diversity of plants remember if you need some "
                  "inspo you can check out my previous video somewhere here first cut out sugar sugar cause "
                  "inflammation and feed bad bacteria so it's just not good for your gut health just try cutting out "
                  "all refined sugars and maybe for like short period of time you may want to cut out even some "
                  "healthy sugars in fruits you may want to cut out allergens like dairy and gluten i mean dairy in "
                  "general it's not really good for you so you can see the difference when you are eliminating daily "
                  "there are some supplements that can help you to heal your gut like for example l-glutamine which "
                  "is an amino acid that heal your gut lining other popular supplements for the gut health are "
                  "slippery elm hydrolyzed collagen and omega-3 as a good source of prebiotic i highly recommend "
                  "psyllium husk it showed great results for our gut health to kill the parasites you may want to "
                  "consider oregano oil black walnut oil or grape seed extract also when i was in the hospital with "
                  "my painful bloating i have been recommended to take some fennel fennel is good for gas you may "
                  "want to take some pills with a dried fennel or you can also try making some ayurvedic tea for your "
                  "gut health this tea includes cumin seeds fennel seeds and coriander seeds okay lastly let's "
                  "quickly talk about the lifestyle changes eat mindfully be sure to mindfully enjoy every single "
                  "bite of your food focus on your food and don't watch tv when you eat your food notice how your "
                  "food looks on your plate pay attention to texture smells and looks all the colors chew your food "
                  "do you guys know that digestion actually starts in your mouth when you chew your food it's so much "
                  "easier for your digestive tract to work properly follow a regular eating schedule i aim to eat "
                  "every three to four hours when you don't eat your food at a consistent times it actually causes "
                  "your gut and stomach to overwork which often results in bloating and gas drink plenty of water you "
                  "guys know we all are made of water mostly and we have to drink lots of water every day and keeping "
                  "our body hydrated is essential for a gut health move your body regularly exercise is very "
                  "important not for our overall health but for our gut health as well it may help to reduce "
                  "inflammation and constipation and i really like this ayurvedic 100 steps rule to help your "
                  "digestive system okay the very very last thing is manage your stress levels i just can't emphasize "
                  "enough how important it is for a health stress can win your digestive system so make sure to "
                  "include some relaxing practices into your daily routines you may want to try meditation or breath "
                  "work i even do have my breath work practices in the morning you can check out my morning routine "
                  "video and see what else you can do to distress yourself and remember you need to get an adequate "
                  "amount of sleep sleep is very very important and besides the night sleep you may want to try "
                  "napping during the day and it's actually very common in some blue zones when it comes to the "
                  "mindset it's very common to think like oh my god why i'm so miserable why i suffer that much with "
                  "my gut problems why it's happening to me what's going on and like i'm the most miserable person on "
                  "earth but the victim mindset is not going to help you guys instead you can think like maybe it's "
                  "happening not to me maybe it's happening for me maybe there is like a lesson maybe there is an "
                  "opportunity to grow to learn something and to feel amazing actually in the future so just change "
                  "your mindset because as i told you victor mindset is not going to help you i have so many amazing "
                  "topics coming up from criminal health and gut health to acne and weight loss so make sure to "
                  "subscribe because you guys you don't want to miss out and if you guys have any tips you want to "
                  "share with us please leave a comment below and i'll see you soon ciao")

    summary = generate_summary(transcript)
    if summary is None or summary.strip() == "":
        print("error Could not generate summary or summary is empty")
    else:
        print(summary)

this returns no summary

@Sauce16
Copy link

Sauce16 commented Apr 9, 2024

Hi I am also getting an emty string as output. Did you find the solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants